Need help with 11. Review


#1

Tab locks up when I try to run this code.

for (var i = 0; i<5; i++){
    console.log(i);
}

var condition = true;

do{
    console.log("please dont crash");
}
while(condition){
    console.log("Condition is true");
    condition = false;
}


#2

This will happen if the initial var assignment and the while condition are the same. There is nothing causing the loop to stop.


#3

There is also a problem of syntaxe:

The syntaxe of a do... while statement is:

do {
    code block to be executed //all the code to execute must be here (not after the while)
}
while (condition);

for more...


#4

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