Is this creating an Infinite loop, the tab crashes whenever I submit


Tab open in the browser freezes

var understand = true;

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


Yes it is, Loops always have to be incremented! If your variable = true outside the loop it must change to false for the loop to end


The problem is this condition. Mainly this part:

understand = true

this is not a comparison but an assignment. So first of all understand = true will make understand become true no matter what it initially was. But even worse the expression understand = true itself has a value of true (because assignments itself always have the value you assign) therefore you have while(true) which is an infinite loop.

To fix it just use == or === instead of =.

I dont understand

The proper way to run your code would be

var understand = true;

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

When you write with the = true and without a semicolon after understand = false Its as if you want your loop never to end.