2/11 jesus


i dont get it
var understand = true;

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


Try changing your while loop to while(understand). You do not have to put understand = true because you have already said that when stating the variable.



you have to use either == or === for a does this equal that argument.

see this link for a list of Comparison and Logical Operators - http://www.w3schools.com/js/js_comparisons.asp




thanks @ragezapper it worked


To combine @ragezapper's and @keefyboooo's answers
The problem is this line:

while(understand = true){
understand = true

What your do here is you assign true to understand and if you have a look at the value of this statement:

console.log(understand = true);

you see that the value is true. So in the hand you have while(true){...} which is the classical infinite loop and even changing the value of understand cannot change this.

Now what you can do is to fix this by not assigning the value but comparing the two values by either == or ===. == just compares the values and === checks the types as well. But if you have a close look you see that

value === true

is true if value is true and false if value is false. So the overall result is equal to the value of value. So what you can do instead is to just use understand instead of understand === true.