jQuery isArray() Method

Beginner
5 min read
Updated: Nov 2026
3 examples
Utilities

Definition

jQuery.isArray(obj) (alias $.isArray) returns true when obj is a true JavaScript Array (since jQuery 1.3). Array-like objects are not arrays.

Syntax

Start with these common calls. Keep them short and readable.

jQuery
$.isArray(obj)  → true | false

$.isArray([])           // true
$.isArray({})           // false
$.isArray($("div"))     // false  (jQuery collection)
$.isArray("hi")         // false

// Prefer in new code:
Array.isArray([])       // true
CallWhat it does
isArray()Learn jQuery.isArray(): test for a true JavaScript array, avoid array-like false positives, migrate to Array.isArray (deprecated 3.2), examples, pitfalls, and FAQs.

Load jQuery before your script (CDN or local file), then wrap DOM work in $(function () { ... }) when needed.

Parameters

ParameterDescription
Step 1Have a value of unknown type (API data, option, argument).
Step 2Call $.isArray(value) (legacy) or Array.isArray(value) (preferred).
Step 3If true, treat it as a real array (.map, $.grep, etc.).

Return Value

Return ValueDescription
BooleanOften true or false depending on the match or state.
Value / undefinedGetters usually return a value from the first matched element, or undefined when nothing applies.

jQuery Examples

Example 1 — Array vs Plain Object

The classic true/false pair.

jQuery
console.log($.isArray([]));  // true
console.log($.isArray({}));  // false
Try It Yourself

How It Works

  1. Empty array. [] is a real Array → true.
  2. Empty object. {} is a plain object → false.
  3. Same typeof. Both look like "object" to typeof.

Example 2 — Array-Like Is Not an Array

jQuery collections look list-like but fail the test.

jQuery
var $els = $("body");
var real = [1, 2, 3];

console.log($.isArray($els));  // false
console.log($.isArray(real));  // true
console.log($els.length);      // 1 (array-like, still not an Array)
Try It Yourself

How It Works

  1. jQuery object. Has length and indexed elements, but is not an Array.
  2. Real array. [1, 2, 3] passes $.isArray.
  3. Length alone. $els.length can be positive while isArray is still false.

Example 3 — Why typeof Fails

Show the classic pitfall students hit first.

jQuery
console.log(typeof []);           // "object"
console.log(typeof {});           // "object"
console.log($.isArray([]));       // true
console.log($.isArray({}));       // false
Try It Yourself

How It Works

  1. typeof. Arrays and plain objects both report "object".
  2. isArray. Splits them correctly into true / false.
  3. Rule. Never use typeof value === "array" — that string never appears.

Frequently Asked Questions

jQuery.isArray(obj) returns true when obj is a true JavaScript Array, and false otherwise. It does not treat array-like objects (jQuery collections, NodeLists, arguments) as arrays.
Yes. It was deprecated in jQuery 3.2 and removed in jQuery 4.0. Prefer the native Array.isArray() method in all new code.
No. NodeLists, HTMLCollections, arguments, and jQuery DOM collections return false. Convert with $.makeArray() (or Array.from) if you need a real array.
Both test for true arrays. In modern jQuery, $.isArray typically delegates to Array.isArray. Use Array.isArray in new projects; keep $.isArray only when reading legacy jQuery code.
typeof [] returns "object", the same as plain objects. That cannot tell arrays from {}. Use $.isArray() or Array.isArray() instead.
jQuery.type(value) returns the string "array" for arrays. jQuery.isArray(value) returns true for those same values. Prefer isArray (or Array.isArray) when you only need true/false.
Yes, if an older jQuery that still includes isArray is loaded. Prefer Array.isArray everywhere — it is native and does not need jQuery.

Next: isEmptyObject() Method

Check whether a plain object has no enumerable properties.

isEmptyObject() Method tutorial →

CODETOFUN NEWS

Stay Ahead in Tech

Get the latest IT news, programming updates, and technology trends directly on your phone.

Your daily dose of tech, straight to your feed.

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.

8 people found this page helpful