8. Last practice for Loop


#1


https://www.codecademy.com/en/courses/javascript-beginner-en-NhsaT/1/3?curriculum_id=506324b3a7dffd00020bf661


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) {
    console.log(var);
}


#2

log i to the console, not var


#5

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


#6

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


#7

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