Shouldn’t it be null is null and is not an object ?
of coz “typeof null” should return ‘null’. Unfortunately it returns ‘object’ as ECMAScript spec. Brendan Eich confirmed that it’s a mistake, but it’s too late to fix it. Let’s waiting for ECMAScript edition 6 or 7 to fix it…
I dont think that’s a mistake, as it makes an easy way to return an empty ‘error’ object.
What I dont understand is why there is upper+lowercase number, string and boolean… or why classes also return object, and you need toString() to get the real type…
var n = 5; // typeof n == ‘number’
var m = new Number(5); // typeof m == ‘Number’
I think they said that will change that.
Intellectus humanus luminis sicci non est, sed recipit infusionem a voluntate et affectibus.
Francis BaconNovum Organum Scientiarum (1620)
© 2017 Notes Log
Theme by Anders Noren — Up ↑