jQuery makeArray() Method

Beginner
5 min read
Updated: Nov 2026
3 examples
Utilities

Definition

jQuery.makeArray(obj) (alias $.makeArray) turns an array-like object into a true JavaScript Array (since jQuery 1.2) so you can use .reverse(), .map(), .pop(), and other native methods.

Syntax

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

jQuery
$.makeArray(obj)  → Array

// NodeList / HTMLCollection
var elems = document.getElementsByTagName("div");
var arr = $.makeArray(elems);
arr.reverse();

// jQuery collection
$.makeArray($("li"));  // plain array of DOM nodes

// Array.isArray(result) → true
CallWhat it does
jQueryLearn jQuery.makeArray(): convert NodeLists, jQuery collections, and arguments into true JavaScript arrays, reverse and map, vs toArray and Array.from, examples, pitfalls, and FAQs.

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

Parameters

ParameterDescription
Step 1Start with a NodeList, HTMLCollection, jQuery object, or arguments.
Step 2Call $.makeArray(obj).
Step 3Use native array methods (reverse, map, filter, …).

Return Value

Return ValueDescription
jQuery objectMost setters and traversing helpers return the jQuery collection so you can chain more methods.

jQuery Examples

Example 1 — Convert a NodeList

Turn querySelectorAll into a real array.

jQuery
var nodeList = document.querySelectorAll("p");
var arr = $.makeArray(nodeList);

console.log(Array.isArray(nodeList)); // false
console.log(Array.isArray(arr));      // true
console.log(arr.length);              // number of <p> nodes
Try It Yourself

How It Works

  1. Select. querySelectorAll returns a NodeList — array-like, not an array.
  2. Convert. $.makeArray(nodeList) copies indexed items into a new array.
  3. Check. Array.isArray is false before and true after.

Example 2 — Convert a jQuery Object

Official pattern: jQuery collection in, plain array out.

jQuery
var obj = $("li");
var arr = $.makeArray(obj);

console.log(typeof obj === "object" && !!obj.jquery); // true
console.log(Array.isArray(arr));                      // true
console.log(typeof arr.jquery);                       // "undefined"
Try It Yourself

How It Works

  1. jQuery object. $("li") is array-like and has a .jquery version string.
  2. Convert. $.makeArray(obj) yields DOM nodes in a plain array.
  3. Methods gone. arr.jquery is undefined — special jQuery features are dropped.

Example 3 — Convert arguments

Turn the function arguments object into a joinable array.

jQuery
function collect() {
  return $.makeArray(arguments).join(", ");
}

console.log(collect("a", "b", "c")); // "a, b, c"
Try It Yourself

How It Works

  1. arguments. Inside a function it is array-like but not a real array.
  2. Convert. $.makeArray(arguments) unlocks .join().
  3. Join. Values become the string "a, b, c".

Frequently Asked Questions

jQuery.makeArray(obj) converts an array-like object into a true JavaScript Array. It returns a plain array you can pass to native methods like .reverse(), .map(), and .filter(), or to jQuery utilities such as $.merge() and $.grep().
Any object with a numeric length and indexed values — NodeLists, HTMLCollections, the arguments object, jQuery collections, and custom { 0: 'a', 1: 'b', length: 2 } objects. Plain objects without length are not array-like.
makeArray() is a static utility that accepts any array-like input. toArray() is an instance method on a jQuery DOM collection only. Both produce a plain JavaScript array of DOM nodes when starting from a jQuery selection.
No. After conversion the result is a plain array. jQuery-specific methods on the original jQuery object are gone — wrap again with $() if you need jQuery methods on the elements.
Both convert array-like objects to arrays. Array.from() is native ES2015+. jQuery.makeArray() has been available since jQuery 1.2 and is a natural fit in jQuery codebases for NodeLists, jQuery objects, and the arguments object.
Use $.makeArray() when you already depend on jQuery, need to convert the arguments object, or want one consistent utility across NodeLists and jQuery objects. Modern code may use [...nodeList] or Array.from() when jQuery is not required.

Next: inArray() Method

Search for a value in an array and get its index with jQuery.

inArray() 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.

9 people found this page helpful