DEV Community


Discussion on: Typeof array is an object in javascript

lexlohr profile image
Alex Lohr

Class instances are also objects. An array literal is just an instance of the Array global constructor. Side note: overwriting the globalThis.Array/Object class can be (ab)used to steal data for example from JSONp responses.

If you want to know the actual type of the object, have a look at, which should result in [object Array].