3 ms·
if you put var in-front you don't have to worry about reassigning a variable from parent scope. You also make assignment and comparison semantically different,
by z3t4 7y ago
if you put var in-front you don't have to worry about reassigning a variable from parent scope. You also make assignment and comparison semantically different, example var foo=1; vs foo=1 if(foo=1) and it's thus easier to spot bugs and understand the code.