Closed paulvollmer closed 7 years ago
Arrays are objects; this is correct.
yes, this is the ecmascript declaration but if you write Array.isArray({foo: 'bar'})
it return false.
if you call this an array is not an object...
Because Array.isArray
is asking "is it an array?" An array is an object - an object is not necessarily an array.
ok. how can i check if it is an object. i expect that the given data should be only an object, nothing else
x && typeof x === 'object' && !Array.isArray(x)
.
looks like a bug that an array to be an object pass the test.