Export (0) Print
Expand All

Array.isArray Function (JavaScript)

Returns a Boolean value that indicates whether an object is an array.

Array.isArray(object)

object

Required. The object to test.

true if object is an array; otherwise, false. If the object argument is not an object, false is returned.

The following example illustrates the use of the Array.isArray function.

var ar = [];
var result = Array.isArray(ar);
// Output: true

var ar = new Array();
var result = Array.isArray(ar);
// Output: true

var ar = [1, 2, 3];
var result = Array.isArray(ar);
// Output: true

var result = Array.isArray("an array");
document.write(result);
// Output: false

Supported in the Internet Explorer 9 standards document mode. See Version Information.

Not supported in the following document modes: Quirks, Internet Explorer 6 standards, Internet Explorer 7 standards, Internet Explorer 8 standards.

Community Additions

Show:
© 2014 Microsoft