Lodash _.isArray() method

Beginner
⏱️ 6 min read
📚 Updated: May 2026
🎯 3 Code examples
🚀 3 Try-it labs
Lodash

What you’ll learn

  • How _.isArray(value) classifies real Arrays.
  • Why array-like plain objects and typed arrays usually return false.
  • How this lines up with native Array.isArray.
  • When to pair with _.isArrayLike, castArray, or toArray.

Prerequisites

Comfort with JavaScript Arrays and the idea that some objects expose length without being Arrays.

  • You know [] literals versus plain { } objects.
  • You can open Try-it labs in the browser.

Overview

_.isArray is the lodash-branded way to ask “Is this an Array instance?”—useful in pipelines, predicates, and mixed-input utilities where you want the same semantics as Array.isArray but consistent lodash imports.

Strict Array branding

Nested arrays, sparse arrays, and Array subclasses still count when the chain matches.

Not duck typing

{ length: 1, 0: "x" } is array-like but fails _.isArray.

Typed arrays excluded

Uint8Array and friends need separate checks when you care about binary buffers.

Syntax

javascript
_.isArray(value)
  • value: any value to test.
  • Returns: true if value is an Array; otherwise false.
1

Literals, nested arrays, and Array.of

Ordinary Array instances—including nested structures created with literals or Array.of—pass the check.

javascript
import isArray from "lodash/isArray";

isArray([]);                  // true
isArray([1, 2, 3]);           // true
isArray([[1]]);             // true
isArray(Array.of(10, 20));  // true
Try it Yourself
2

Objects, strings, and typed arrays

Common impostors—plain objects, strings, and typed arrays—fail unless you normalize them into real Arrays first.

javascript
import isArray from "lodash/isArray";

isArray({ 0: "a", length: 1 }); // false (array-like object)
isArray("split me");           // false
isArray(new Uint8Array(2));    // false
Try it Yourself
3

Rest parameters and Array.from(arguments)

Rest bundles are real Arrays. Converting legacy arguments with Array.from produces an Array as well.

javascript
import isArray from "lodash/isArray";

function viaRest(...items) {
  return isArray(items);
}

viaRest(1);                    // true

function viaArguments() {
  return isArray(Array.from(arguments));
}

viaArguments(2, 3);           // true
Try it Yourself

📋 _.isArray vs related helpers

APIWhat passes
_.isArray(x) / Array.isArray(x)Array instances only.
_.isArrayLike(x)Objects with finite non-negative length (includes strings, Arguments).
_.castArray(x)Wraps non-arrays; leaves Arrays untouched.

Pitfalls to avoid

DOM

NodeList and HTMLCollection

These are array-like DOM collections, not Arrays—convert with Array.from before assuming array methods.

Buffers

Binary data

Do not use _.isArray to detect Uint8Array or Buffer in Node; use explicit typed-array or Buffer checks.

JSON

Deserialized data

JSON.parse('[1,2]') yields an Array; nested plain objects stay objects—verify shape at boundaries.

❓ FAQ

In Lodash 4 on ordinary JS runtimes, yes—Lodash forwards to Array.isArray so results match for typical Array instances.
Array detection is not duck typing. Plain objects can imitate array-like shapes but still fail _.isArray unless they are real Array instances.
No. Typed arrays and Buffers are distinct built-ins; use typed-array checks or Buffer helpers when you need those types.
Consider normalizing inputs with utilities like Array.from, or use Lodash collection helpers that accept array-like and iterable values.

Summary

  • Purpose: detect Array instances reliably.
  • Aligned with: native Array.isArray on typical runtimes.
  • Next: explore more on Lodash _.isArrayBuffer().
Did you know?

In modern JavaScript engines, Lodash’s _.isArray delegates to Array.isArray: the check is based on whether the value is created with the Array constructor chain, not on whether it has numeric indices and length.

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.

6 people found this page helpful