In this tutorial there is written:
If you redeclare a JavaScript variable, it will not lose its value.
Why should I redeclare a variable? Is it
In javascript there is no block scope so it is advisable to redeclare a variable for clarification purposes; this makes for better code.
For example:
for (var x=0; x< 100; x++) { }
alert(x); //In most languages, x would be out of scope here.
//In javascript, x is still in scope.
//redeclaring a variable helps with clarification:
var x = "hello";
alert(x);