facg3 / chemics

0 stars 1 forks source link

using var and with for loop #11

Open SamerElaila opened 6 years ago

SamerElaila commented 6 years ago

In this line https://github.com/facg3/chemics/blob/cc6da16a2f605969bfaababa5abc402954321073/src/router.js#L26

you guys are using for loop with var which can cause a lot of problems in scoping if there was a delay in executing the code inside the for loop

look for javascript scope for more informations.

ZooeyMiller commented 6 years ago

afaik this is preferable. Initialising i without var means you're creating an implicit global which is generally problematic. I'll read up to see if there's a reason not to, as you say, though.