Object or Array

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]

Author: Binny V A
A philosopher programmer who specializes in backend development and stoicism.

1 thought on “Object or Array

Leave a Reply

Your email address will not be published. Required fields are marked *