+ 1
Why does typeOf return object instead of array in array data type?
2 Réponses
+ 2
Because Array extends Object prototype
Try this in a console or REPL
Array.prototype.__proto__ === Object.prototype
It outputs 'true'
So based on laws of inheritance an Array *IS AN* Object
As an FYI, typeof can only return six possible results: object, function, string, number, boolean and undefined.
Everything else in JavaScript extends from these base prototypes.
+ 1
Explained in my video:
https://youtu.be/y-LnKLCTgw4