Test whether an object is an object or an array
if(Object.prototype.toString.apply(arr) === '[object Array]') alert("Array")
Byte sized tech know-how.
Test whether an object is an object or an array
if(Object.prototype.toString.apply(arr) === '[object Array]') alert("Array")
Copyright © 2024 Txt
Wouldn’t it be easier to use “arr instanceof Array”?
See here for details: http://stackoverflow.com/questions/963607/compressing-object-hierarchies-in-javascript