JavaScript Array isArray() Method

Beginner
5 min read
Updated: Nov 2026
3 examples
Array

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.

Remember
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.

JavaScript
Array.isArray(value)
CallWhat 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
JavaScript
Array.isArray(value)

Parameters

ParameterDescription
ArrayRequired. Constructor that owns the static method
valueRequired. Any value to test

Return Value

Return ValueDescription
*true for arrays, otherwise false

JavaScript Examples

Example 1 — Basic Array.isArray() Checks

See what counts as a real array.

JavaScript
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
Try It Yourself

How It Works

  1. Real arrays pass. Both filled and empty arrays return true.
  2. Strings fail. A string is not an array of characters in this check.
  3. Plain objects fail. {} is an object, not an Array.
  4. null fails. Safe — no crash, just false.

Example 2 — Why Not typeof?

typeof collapses arrays and objects into the same answer.

JavaScript
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
Try It Yourself

How It Works

  1. typeof looks the same. Both array and object report "object".
  2. Array-like is not enough. length + indexes ≠ real array.
  3. isArray separates them. Only the true array returns true.
  4. 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.

JavaScript
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
}
Try It Yourself

How It Works

  1. Check first. Array.isArray runs before map.
  2. Valid path. An array is doubled element by element.
  3. Invalid path. A string is rejected with a clear error.
  4. Safer APIs. Guarding inputs avoids confusing runtime failures later.

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.

99% Browser support
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

Array.isArray(value) returns true if value is a real JavaScript Array, and false otherwise. It is the reliable way to check array type.
It is a static method on the Array constructor. Call Array.isArray(x), not x.isArray().
typeof [] returns "object", which is not specific. typeof cannot distinguish arrays from plain objects or null.
No. Objects with length and numeric keys (like arguments or NodeList) are not true arrays unless you convert them with Array.from().
isArray works across iframes and realms. instanceof can fail when the array comes from a different window or frame.
Array.isArray() is ES5. It works in all modern browsers and has been supported in Internet Explorer 9+.

Next: Array.of()

Create a new array from a list of argument values.

Array.of() tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

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