Have a look at my code snippet ....
Expand|Select|Wrap|Line Numbers
- function test(){
- var s = "Hello!";
- var s = "Hi!";
- alert(s); //it alerts the latest value of s, and here is no duplicate definition of s
- }
Expand|Select|Wrap|Line Numbers
- function test(){
- //some code
- }
- function test(){
- //some latest code
- }
Please explain.