+ 7
Why type of null is object??
Null = Noting, then why typeOf(null) is 'object'?? https://code.sololearn.com/WE154SIWyB8g/?ref=app
8 odpowiedzi
+ 8
null is a primitive type in JavaScript but typeof null returns object, this is a bug in JavaScript language which existed from first version of JavaScript.
This bug cannot be fixed because it would break existing code.
+ 8
You have declared obj as the type of null. Since, null is an object, you are getting object as the answer.
And there is not types of null. Null is actually an object.
+ 6
You mean is Null of type Object? Then yes.
+ 3
& yes, I havn't declared the type of 'obj' (in the code). Then why it works??
+ 2
Because 0 is still a bit.
+ 1
every element that take space is object so when we declare the null it takes space.
+ 1
if null is nothing then why it takes space?
+ 1
Travis this is the simplest, yet the most comprehensive answer I ever got in any question. ++ for you