Trouble in #7!


#1

I am having trouble with my code:

var u = true

while(u) {
console.log("U is true");
}
var u = false

for(var i = 1, i = 3, i++) {
console.log("BlaBlaBla");
}

and i get this error:

Unexpected token '++'

please respond quickly!


#2

is it normal that some ';' are missing at the end of some of your lines ? :smile:


#3

What do u mean '.' at the end of my lines?


#4

oh wait... THX for your help!


#5

np, btw you are going to have an infinit loop, i don't know if it is what you wanted, but it's gonna happen if you don't change a little bit your code ^^


#6

Yeap the while loop runs infinitely because the stopping condition comes after the loop where you can't get to because of obvious reason. Also in your for loop you need to use semicolons instead of commas. Oh and the for loop is an infinite loop as well, as i=3 does not check if i is 3 but sets i to 3. And unfortunately numbers are treated as booleans when used in conditions (where 0 is false and anything else is true) so this is again an infinite loop.


#7

Just click enter its really stupid