For loop, while loop and do loop


#1

I really dont get whats wrong help?

for (var i = 1; i < 11; i++) {
console.log(i);
};

do {
console.log("WOW");
}
while(1 + 1 = 2); {
console.log("wow");
};


#2

while (1+1=2) is infinite loop


#3

First of all be careful with semicolons after conditions, they are not syntactically incorrect, but can lead to unexpected infinite loops:


(it is about conditions but the idea is the same)

while(1 + 1 = 2)

Also = is an assignment operator, better use the comparison operators == and === here because assigning 2 to 1 is pretty "interesting" :wink: