dimanche 3 mai 2015

JavaScript Weirdness - typeof [] === typeof {} evaluates to 'true'

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.

Aucun commentaire:

Enregistrer un commentaire