Syntax?


#1


https://www.codecademy.com/courses/javascript-beginner-en-ASGIv/2/4?curriculum_id=506324b3a7dffd00020bf661


I'm not sure exactly what i'm doing wrong, but there's just an annoying syntax error that won
't go away.. Where's the stupid unexpected token? Or is it just bugged?

// Write your code below!
var abc = false;
for (var i = 0; i < 10; i++) {
    do(console.log("I did it!");
    while (abc) )
}


#2

You need to write three syntactically correct loops in the editor: one for, one while, and one do-while. So, first create for loop:

var i = 0; // I used global variable for all loops
for(i; i < 5; i++) {
   // do smth - write your own code
}

Then while loop:

while(i < 5) {
    // do smth - write your own code
}

And the last one is do-while:

var conditionToExit = false;

do {
   console.log("I'm gonna stop looping 'cause my condition is " + conditionToExit + "!");	
} while (conditionToExit);

#3

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