Syntax problems with exercise 11


#1

Hi,

Please can you help me with these loops? The exercise asks to write a for, while and do loop. This is the code I wrote:

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

var condition = true;
while(condition) {
console.log("State");
condition = false;
}

do {
console.log("State");
while(condition);
}


#2

Hi the do/while should have that strutture

do {
    #do something
} while(condition)

#3

@artemis-darcy,

the for-loop:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for

the while-loop:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/while

the do-while-loop:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/do...while