Code academy keeps freezing in while syntax. HELP!


#1

The exercise I am stuck at is "Introduction to 'While' Loops in JS: While Syntax."


Once I add the condition after while, the whole page doesn't respond and it crashes after a few minutes. I've tried submitting this code on my laptop, and on various computer but they all crash. Is there anything wrong with my code that's causing an infinite loop?

var understand = true;

while(3*2 ===6){
	console.log("I'm learning while loops!");
	understand = false;
}

#2

Yes that's an infinite loop, do you think that it should be stopping on its own? If so, explain how!

Where is the decision made about whether to continue the loop or not? Look at that part of the code.


#3

I am not sure. I feel like that when I assigned true to understand it contradicts the understand = false. I am still not sure, and I'm getting frustrated. It said not to change the understand variable so I don't what else to do. Should I change the condition?


#4

The expression in your condition always evaluates to true which means it will go on forever.
If you want the loop to ever stop, then you have to change that condition or break out of the loop. I suggest reading over the instructions again to get a firmer idea about what it is you're meant to do.


#5

Oh!!! That makes sense, thank you! :slight_smile: