Trouble in #7!


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++) {

and i get this error:

Unexpected token '++'

please respond quickly!


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


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


oh wait... THX for your help!


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 ^^


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.


Just click enter its really stupid