Q: JavaScript - variable "name" has type string and equals null This a bit of code just broke my mind. If I press cancel, the values of name and password must be null but in the name case comparison name == null returns false and password == null returns true.


var name = prompt('What is your name?', '');
console.log(name);
console.log(name == null); //false

var password = prompt('Password?', '');
console.log(password);
console.log(password == null); //true


But if set another name for variable, it works fine


var userName = prompt('What is your name?', '');
console.log(userName);
console.log(userName == null);


I made some checking 


console.log(typeof name); //String
console.log(name); //null


(As I see, console.log(name); returns some value in the snippet here)    
I've found name in the list of reserved words in JavaScript but I have not found any explanation about this behavior.
