When I test this code snippet in jsFiddle with JSLint, it gives me this strange warning:
Problem at line 3 character 10: Cannot set property ‘first’ of
undefined
But if I declare the variable currentNumber outside of (i.e. before) the for-loop, it doesn’t complain.
What is the reason of this?
Looks like a bug in jsFiddle or JSLint, honestly… If I try
for (var i = 0; i < 10; ++i) {}it gives the same error. If I take outvarit stops complaining.