What's the role of this?!


var understand = true;

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

please can someone explaine to me why they write understand = false; what's the role of it ?!


We declared

understand = false;

to stop the looping, because as long as the condition evaluates to true, the loop will continue to run. and if your loop continue to run, your browser will crash.


i understand now thank you :relaxed:


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.