Would the following code cause any issues?:
var a = 1;
var a = 2;
My understanding is that javascript variables are declared at the start o
Declaring the same variable twice is as good as declaring it once. Below statement will not bring any impact.
var a, a;
in the below case you are just overriding the variable foo. This will have an impact if you have foo defined in the local and global scope. JS will search foo in the local scope first and then if it doesn't find it will look in the global scope.
var foo;
var bar;
foo = 'a';
foo = 'b';
bar = 'c';