YouTip LogoYouTip

Misc Makearray

# jQuery.makeArray() Method [![Image 4: jQuery Miscellaneous Methods](#)jQuery Miscellaneous Methods](#) ## Example Convert an HTML element collection to an array $(function(){var elems = document.getElementsByTagName("div"); // Returns a node list var arr = jQuery.makeArray(elems); arr.reverse(); // Use an array method on the list's elements $(arr).appendTo(document.body); }) [Try it Β»](#) * * * ## Definition and Usage $.makeArray() function is used to convert an array-like object into a true array object. **Note:** Array-like objects have many properties of arrays (such as the length property, [] array access operator, etc.), but they are not really arrays. They lack the built-in methods inherited from the array prototype object (such as: pop(), reverse(), etc.). * * * ## Syntax _$_.makeArray( object ) | Parameter | Description | | :--- | :--- | | _object_ | Object type An array-like object that needs to be converted to an array. | * * * ![Image 5: Example](#) ## More Examples (#) Convert a jQuery object to an array. [![Image 6: jQuery Miscellaneous Methods](#)jQuery Miscellaneous Methods](#)
← Misc NowMisc Isnumeric β†’