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


#1


https://www.codecademy.com/courses/javascript-beginner-en-qDwp0/0/3?curriculum_id=506324b3a7dffd00020bf661#


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"?


#2

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


#3

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