Reputation: 1070
I know the strict equals in JS evaluates two things: equality and like-typedness
Object.is() is the closest comparison I could find to gather further insight and it offered little further in my investigation.
Can anyone who groks the innards of JS better explain this? Is an array a very very strange implementation of an object? So they are empty and evaluate the same here?
I'm quite perplexed and just curious.
Upvotes: 4
Views: 379
Reputation: 53301
Arrays are objects with a number of additional methods -- MDN defines them as "high-level, list-like objects," and goes on to say:
Arrays are list-like objects whose prototype has methods to perform traversal and mutation operations.
Upvotes: 2
Reputation:
typeof
returns the primitive type of the operand. For anything other than bools, numbers, strings, functions, and undefined, this is object.
Upvotes: 3