Saturday, June 13th, 2009 11:56 PM
Test whether an object is an object or an array
if(Object.prototype.toString.apply(arr) === '[object Array]') alert("Array")
Original Article
1 Comment »
Tuesday, March 6th, 2007 08:44 AM
Find whether the given variable is an object,or is an Array?
function isArray(testObject) {
return testObject && !(testObject.propertyIsEnumerable('length')) && typeof testObject === 'object' && typeof testObject.length === 'number';
}
Original Page
[tags]javascript,object,array,type[/tags]
1 Comment »