Helllp!


#1

for ( var i=0; i<5; 1++);
console.log("here we go!");

var j=0;
while (j<5);
console.log ("oh yeah!");


#2

Hello, there.

You have something wrong here.

This is wrong:
while (j<5);console.log ("oh yeah!");

Should be:

for (var i = 0; i < 5; 1++);
Console.log("here we go!");

while (j < 5) {
Console.log ("oh yeah!");
}

Can you try that?

Or you need to give me the full code. :expressionless:


#3

You have a bit too many semicolons ;
And some would prefer to use {}'s even when it's just one line for consistency.

A for-loop is an immediately recognizable pattern due to being so common, so it's usually preferred, but you ould also do:

while (j++ < 5) {
    console.log("purple");
}

#4

Also here is something to read on why the semicolon after the while loop leads to problems:


(it's on conditions but loops work kind of similar)