DEV Community

Discussion on: What is the oddest JavaScript behavior?

Collapse
 
antontsvil profile image
Anton T

The "everything is an object" approach is takes is such a double edged sword. On one hand it's nice to use index access for objects but typeof [] being object is just silly if you're coming from another language.

I had a stubborn bug where an array was refusing to be identified by Array.isArray in my code yet if I tried it in the console it would work. Even recreating it by inserting it into a blank array using spread syntax like [...myArray] still failed the isArray test :/