8.Last Practice for Loop


#1


On section 5.8, Last Practice for loop

The code below is just returning 0. Seeing the message "Oops, try again. Your loop didn't log 100 to the console!". Cant work out what I'm doing wrong. Any help please? Thanks!

for ( var i = 100; i>0; i-=5); {
    console.log(i);
    }


#2

here:

for ( var i = 100; i>0; i-=5); // this one

your last semi-colon interrupts your loop, it doesn't belong there. Remove the semi-colon


#3

Or rather, it does nothing 20 times, since the statement to repeat is an empty statement


#4

Ah yes I see now! Thanks for your help!


#5

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