While Loop 2



Why is this creating an infinite loop?

var understand = true;

while(understand = true) {
	console.log("I'm learning while loops!");
	understand = false;


The result of assignment is the assigned value.

var a;
var b = (a = 5);
console.log(b);  // 5


Actually I figured it out. In the while condition I had reassigned understand with = rather than checking it with ===.


I thought I said that :confused:


You said it confusingly. I read that, figured it out, read it again, replied, read it again, and the finally realized what you meant.