Export (0) Print
Expand All

Array.isArray Function (JavaScript)

Determines 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 following document modes: Internet Explorer 9 standards, Internet Explorer 10 standards, and Internet Explorer 11 standards. Also supported in Store apps (Windows 8 and Windows Phone 8.1). See Version Information. Not supported in the following document modes: Quirks, Internet Explorer 6 standards, Internet Explorer 7 standards, Internet Explorer 8 standards.

Show:
© 2014 Microsoft