This is causing my tab to become unresponsive


#1

I've added my code in, but its making my page stop responding xD please let me know if I'm doing something wrong.

var understand = true;

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

#2

In JS, you should have the code format as:

do {
    code block to be executed
}
while (condition);

With your code, you're confusing the computer.

Also, this line understand = true, I guess you are trying to compare hence it should be ===.

Hope this helps! :smile:


#3

So I wrote it as:
do {
console.log("I'm learning while loops!");
understand = false;
}
while( understand = true);

But it's still crashing my page >.<


Thanks! It was my comparison ^.^


#4

That's a comparison I believe, use ===.

You then should have:

var understand = true; //not so necessary

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

Hope this helps! :smile: