Review 11 (+ do and while)


#1


Hi this is from the review part. I am still uncertain about the use of 'do' and 'while'. I'm quite lost about it can someone explain?


My code has syntax error but I'm not very sure what is it. Appreciate all your help! thank you!


for (var i=0, i<10;i++)
{console.log("yay");};

var loopornot=false;
do{console.log("Just stop here");}
while(loopornot);


#2

You used a comma instead of a semicolon here:

for (var i=0, i<10;i++)

and the semicolon at the very end here:

{console.log("yay");}; // <--

isn't necessary. The rest seems to be fine. For an overview about loops you might have a look at this:


or ask again if something is not clear, but as said so far you're code seems to be ok.


#3

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