Posts Tagged With: array

Object Or Array Check in JavaScirpt

Tagged with: , , , ,

Test whether an object is an object or an array


if(Object.prototype.toString.apply(arr) === '[object Array]') alert("Array")

Original Article

1 Comment »

Object or Array

Tagged with: , , ,

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 »