4/11... I get rid off the triple = then the crashs start rolling in


#1

I get rid of the "===" to be "=" it still doesn't work. And the code keeps sending continuous loops so it my tab to freeze and has crashed my computer every once and a while. Help Plz


#2

check this

var bool =1

while(bool)

then within the while loop your bool should return something else like 0 to terminate the loop


#3

Could you post the code your talking about?


#4

var bool = true;

while(bool === true){
console.log("Less is more!");
bool = false;
}
This is what they give you and I guess your just suppose to replace === to =


#5

Ok after a long time trying to figure this out. I learned you only needed to take out the === true statement
I learned to stop being ignorant and its ok to look up the answer to figure out how you were wrong


#6

Yes the point is that bool === true and bool have the same value as you can prove:

bool === true is true for bool being true
bool === true is false for bool being false

So if you're feeding it with booleans they are equal. Replacing the === with = does a different thing. = is the assignment operator so you dont check if bool is true but set it to be true and the whole statement bool = true has a value of true. So no matter what bool was beforehand now it is true and the condition is true as well and will always be as you always do this assignment here -> infinite loop.

Yes it's ok to look up the answers and learn from your mistakes or have a look if there are better ways to do something.


#7

var bool = true;

while(bool){
console.log("Less is more!");
bool = false;

}
just do this