Home JavaScript Array Methods isArray() JavaScript Array isArray() Method Definition In JavaScript, Array.isArray(value) is a static method that returns true only for real arrays. Call it on Array, not on the value: Array.isArray(x) — not x.isArray(). Prefer it over typeof and, in multi-frame apps, over instanceof Array.
Array.isArray(value) → true | false
Array.isArray([1, 2]) → true
Array.isArray("hi") → false
Array.isArray({ length: 1 }) → false // array-like, not array
typeof [] → "object" // not specific!
call: Array.isArray(x) // static — not x.isArray() Syntax Call Array.isArray. Start with this line.
Call What it does Array.isArray(value)Primary signature. Array.isArray(...)Call with the arguments your case needs.
Built into JavaScript. Call Array.isArray(...) on the Array constructor — no import required.
Library declarations Parameters Parameter Description Array Required. Constructor that owns the static method value Required. Any value to test
Return Value Return Value Description * true for arrays, otherwise false
JavaScript Examples 1. Basic checks 2. vs typeof 3. Guard a function Example 1 — Basic Array.isArray() Checks See what counts as a real array.
console.log(Array.isArray([1, 2, 3])); // true
console.log(Array.isArray([])); // true
console.log(Array.isArray("hi")); // false
console.log(Array.isArray({ a: 1 })); // false
console.log(Array.isArray(null)); // false true
true
false
false
false How It Works Real arrays pass. Both filled and empty arrays return true.Strings fail. A string is not an array of characters in this check.Plain objects fail. {} is an object, not an Array.null fails. Safe — no crash, just false.Example 2 — Why Not typeof? typeof collapses arrays and objects into the same answer.
const arr = [1, 2];
const obj = { length: 2, 0: "a", 1: "b" };
console.log(typeof arr); // "object"
console.log(typeof obj); // "object"
console.log(Array.isArray(arr)); // true
console.log(Array.isArray(obj)); // false How It Works typeof looks the same. Both array and object report "object".Array-like is not enough. length + indexes ≠ real array.isArray separates them. Only the true array returns true.Convert if needed. Use Array.from(obj) when you need array methods.Example 3 — Guard a Function Parameter Reject non-arrays before calling methods like map.
function doubleAll(input) {
if (!Array.isArray(input)) {
throw new TypeError("Expected an array");
}
return input.map((n) => n * 2);
}
console.log(doubleAll([1, 2, 3])); // [2, 4, 6]
try {
doubleAll("123");
} catch (err) {
console.log(err.message); // Expected an array
} How It Works Check first. Array.isArray runs before map.Valid path. An array is doubled element by element.Invalid path. A string is rejected with a clear error.Safer APIs. Guarding inputs avoids confusing runtime failures later.Compatibility
Browser & Runtime Support Array.isArray() is part of ES5 . It has been available in browsers and Node.js for a long time.
✓ Baseline · ES5
Array.isArray() Supported in all modern browsers, Internet Explorer 9+, and every current Node.js release.
Google Chrome Supported · Desktop & Mobile
Full support
Mozilla Firefox Supported · Desktop & Mobile
Full support
Apple Safari Supported · macOS & iOS
Full support
Microsoft Edge Supported · Chromium
Full support
Internet Explorer No native support · Use a polyfill
Polyfill
Opera Supported · Modern versions
Full support
Samsung Internet Supported · Android
Full support
Bun Supported · JavaScript runtime
Supported
Deno Supported · JavaScript runtime
Supported
Node.js Supported · Server runtime
Supported
Android WebView Supported · Modern WebView
Full support Array.isArray() Excellent
Bottom line: Safe almost everywhere. Use it as your default array type check in libraries and application code.
Frequently Asked Questions What does Array.isArray() do? Array.isArray(value) returns true if value is a real JavaScript Array, and false otherwise. It is the reliable way to check array type.
Is Array.isArray() a static or instance method? It is a static method on the Array constructor. Call Array.isArray(x), not x.isArray().
Why not use typeof for arrays? typeof [] returns "object", which is not specific. typeof cannot distinguish arrays from plain objects or null.
Does Array.isArray() return true for array-like objects? No. Objects with length and numeric keys (like arguments or NodeList) are not true arrays unless you convert them with Array.from().
How is Array.isArray() different from instanceof Array? isArray works across iframes and realms. instanceof can fail when the array comes from a different window or frame.
Which browsers support Array.isArray()? Array.isArray() is ES5. It works in all modern browsers and has been supported in Internet Explorer 9+.
About the author Developer, cloud engineer, and technical writer
I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.
11 people found this page helpful
Helpful Share Copy link Suggestion