Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

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

Requirements

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.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2015 Microsoft