Doesn't get error, just a quick question: For or while


Just a quick question: Everytime I wrote my code like this:

var name = true;
    while(name) {
        console.log("Printed the while-loop");
        name = false;

I got an infinite loop. But as soon I changed the variable to: 

var statement = true;
    while(statement) {
        console.log("Printed the while-loop");
        statement = false;

It worked. Maybe I am just stupid, but why does it crash when I use the variable "name"?


i had to google this, but name is an attribute for the anchor html element (<a></a>), which is why it is not working. source


All right. Had a lot of trouble figuring out why it kept crashing haha. Thanks! :sunglasses: