'While' loops in JS can't figure this one out



Oops, try again. It looks like you didn't print the string to the console. Check your loop syntax!

var understand = true;

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


You have set the variable understand to be a boolean, but you're checking it as an int. This will return an error because they are different data types.

Try checking if understand is equal to true instead.


Hi there. Your while condition testing is a little off.

The while loop will commence when the condition tested is true. At the moment we're saying.

Is understand (true) equal to 0 (false). Nope (false). Therefore we will not enter the while loop.

If instead you did


This would work because remember, while will run as long as the conditon in it's parentheses is true. In which case it is.


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