8/11 when to while and when to for infinite loop


#1

var x = true;
var y = function(){
while(x = true){
console.log("I win");
x = false;
}
};
for(var x = 10; x<36; x + 5) {
console.log(x);
};

It is an infinite loop, but I don't understand how.


#2

x+5

doesn't change the value of x.

x = x+5

is what you want to do.


#3

Thank you that fixed it