Infinite loops in While loops review


Hi everyone!

Can anyone explain me why the following code turns into infinite loop? In my opinion it's exactly the same as the code in the previous exercises which worked just fine, but surely I just don't see something wrong in the code.

Could You tell me what is wrong with it?

Thanks in advance.

var understand = true;

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

Everything works fine when I change while (understand) to while (understand === false)...
Which makes me totally confused...


you are mashing the do-while-loop and while-loop...

the while-loop:

the do-while-loop:


Thanks man! Definitely didn't see it won't work that way...