In node.js
> var name = 12;
> console.log(typeof name);
number
in Firefox's web console
var name = 12;
console.log(typeof name);
string
let name2 = 12;
console.log(typeof name2);
number
Why is the difference between var
and let
in Firefox?
Why is no such difference in node.js?
There's an inbuilt property on window
called name
:
console.log(name);
So your code will look for that, not the name
you create.