In javascript variables have function scope only. So it's either global or it's a variable accessible in the entire function regardless of exactly where it was declared (within the function).
I'm guessing best practice would be to declare all variables at the top level right after 'use strict';
?
What happens if I have 5 loops where I declare the same i
var?
for (var i = 0; i < someValue; i+=1) { ... }
Is the variable simply reset to 0 or whatever the loop sets it's initial value and everything moves on ? Can this cause complications ?