Page keeps crashing!


It said don’t change line 5! So, I didn’t, but it crashes anyway… I’m on chrome not sure if it matters… I tried changing the equation also… even giving it rest for a day.

var understand = true;

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



1 will always be greater than 0.


ohhhh… I feel stupid




I’m afraid I still don’t get it. If I type in a condition that is true, the loop will run infinitely and crash my browser. If I use a false condition, it won’t do anything at all. Am I supposed to set a condition that will make “understand” true or false, or what?


That’s correct. So what you need to do is set up a condition that starts to be true and turns false while you’re looping.


But doesn’t the boolean become false when you set it false?
That’s why I thought

while( understand = true ){
console.log(“I’m learning while loops!”);
understand = false;
should be right, but it isn’t.


The problem with your code is this:

understand = true

namely = is an assignment operator and not a comparison operator which has the side effect that the whole statement understand = true has the value you assign. Now the value you assign is true so understand = true behaves as if you’d written true as condition. Sure this understand = false set understand to false, but you’re condition turns it to true regardless of what is has been before.


Kay, noticed the problem.
Should use === instead of =