why does browser throw Error for var null;
?
I am reading Javascript Garden-undefined and I know undefined
is a global variable different from null
.
But I am just curious about that why it throws Error when dovar null;
in contrast, when var Number=123
,var Boolean=123
,var Object=123
,var undefined=123
(although useless), etc.,it's ok.
As far as I know, null
is not a reserved word and keyword in JavaScript. It should be a primitive type.
How does var
work exactly in relation to null
?