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
Call
What it does
jQuery
Learn 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
Parameter
Description
Step 1
Start with a NodeList, HTMLCollection, jQuery object, or arguments.
Step 2
Call $.makeArray(obj).
Step 3
Use native array methods (reverse, map, filter, …).
Return Value
Return Value
Description
jQuery object
Most 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
arguments. Inside a function it is array-like but not a real array.
Convert.$.makeArray(arguments) unlocks .join().
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.