While syntax


#1

I'm having an issue with this.

var understand = true;

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

The instructions are to make a while loop
WITHOUT CHANGING
understand = false.

No matter what I put in I either get an error or an infinite loop.


#2

You assigned understand to false, but here should be condition that returns true. It's can be:

while( understand ) { ... }
//or
while( understand === true ) { ... }

#3

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