I have a few for loops
in a document, a simplified example of their usage would be:
for (var i=0; i < element.length; i++) {
element[i];
}
I read somewhere it is best to use different variable names for different loop instances i.e. instead of i
use j
and so on.
Because I have quite a few loops in the script though, it starts to become a lot harder to read with different letters when going through stuff.
If the variable is within parenthesis, will this be OK to still use i
for all of them? I do not have any global variables called i
.
I can't use let
because my boss wants to keep it at var
and not use babel etc.
Thanks in advance for any advice.
Em