I'll give it another try.
if you use
understand = 4 you assign the value 4 to understand so now understand is 4 no matter what it has been before.
But the whole statement itself (understand = 4) also has a value:
console.log(understand = 4); --> 4
which happens to be the value you assign, which is in this case 4.
So effectivily the value in your while loop is:
with the sideeffect that you changed the value of understand to 4.
So as the while loop always expects a boolean in its () it will turn anything used there into a boolean even if it is not a boolean. So I'd strongly recommend that you only use booleans or conditions that evaluate to a boolean (
a>= b, aso) or otherwise have a close look at the link to see which value is translated to which boolean. For the value 4 the links states that every number except 0 is treated as true so 4 is equal to true (at least in this case). Which than creates the infinite loop.
Is this better?