since today I believe in ghosts. Can someone explain the following JS behaviour with Chrome (Version 59.0.3071.115) or Firefox (54.0 (64-bit)) ?
Why?
var name = 10;
console.log(typeof name); // string
console.log(name); // "10"
Same with let works:
let name = 10;
console.log(typeof name); // number
console.log(name); // 10
What I believe is, that window.name is used and it transforms any input to string. But then, why is var name not a local variable and hides the global variable?
Thank you.