8. Last practice for Loop



I keep getting a syntax error that says SyntaxError: unexpected token var. Before this, it said the unexpected token var was all the = signs.

for(var i = 100; i <= 1 ; i -= 1) {


log i to the console, not var


I changed it to console.log(i); but it still isn't working.


your loop condition:

i <= i

for the first iteration (i=100) this condition is false, so the loop ends. So your loop makes zero iterations. Your step are also to small, you take steps of -1, this should be minus 5


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.