Underscore.js _.toArray Function Last Updated : 27 Dec, 2021 Comments Improve Suggest changes Like Article Like Report The _.toArray() function is used to create a real array from the list of items or any other data types that iterated over the elements. Syntax: _.toArray( list ) Parameters: This function accepts single parameter as mentioned above and described below: list: This parameter holds the list of items. Return Value: It returns an array from the list of items. Example 1: html <!DOCTYPE html> <html> <head> <script type="text/javascript" src= "https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.9.1/underscore-min.js"> </script> </head> <body> <script type="text/javascript"> (function () { var arr = _.toArray(arguments).slice(1); console.log(arr); })(1, 2, 3, 4); </script> </body> </html> Output: Example 2: html <!DOCTYPE html> <html> <head> <script type="text/javascript" src= "https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.9.1/underscore-min.js"> </script> </head> <body> <script type="text/javascript"> (function () { var arr = _.toArray(arguments); console.log(arr); })('javascript', 'java', 'unix', 'hypertext', 'underscore', 'CSS'); </script> </body> </html> Output: Comment More infoAdvertise with us Next Article Underscore.js _.toArray Function A ashokjaiswal Follow Improve Article Tags : JavaScript Web Technologies JavaScript - Underscore.js Similar Reads Underscore.js _.pairs() Function Underscore.js _.pairs() function is used to convert an object into an array of arrays that contain the [key, value] pairs of the object as elements. Syntax:_.pairs( object );Parameters:object: It contains the object element that holds the elements of key and value pair.Return Value:It returns the ar 1 min read Underscore.js _.map() Function The Underscore.js is a JavaScript library that provides a lot of useful functions that helps in the programming in a big way like the map, filter, invoke etc even without using any built-in objects. The _.map() function is an inbuilt function in Underscore.js library of the JavaScript which is used 4 min read Underscore.js _.rest() Function The Underscore.js is a JavaScript library that provides a lot of useful functions like the map, filter, invoke etc even without using any built-in objects. The _.rest() is used to return the rest of the elements except the zeroth indexed element. Second parameter is used to start the search from the 3 min read Underscore.js _.isTypedArray() Function Underscore.js is a JavaScript library that provides a lot of useful functions that help in the programming in a big way like the map, filter, invoke, etc even without using any built-in objects. The _.isTypedArray() function is an inbuilt function in Underscore.js library of JavaScript which is used 1 min read Underscore.js _.object() Function _.object() function: It converts the array elements into objects. We can either pass all keys and then all the values or we can pass the key along with their value in pairs. It is used if we have more than one array but we want to make/ form a relation between these arrays. Also, size of the arrays 3 min read Underscore.js _.size Function The Underscore.js is a JavaScript library that provides a lot of useful functions that help in programming in a big way like the map, filter, invoke, etc even without using any built-in objects. The _.size() function is used to find the size of an array, i.e. the number of elements in the array. It 3 min read Underscore.js _.sample() Function Underscore.js _.sample() function is used to find out what kind of elements are present in the array. It gives a random element of the array as output. We can even pass a second parameter to return that number of random elements from the array. Syntax:_.sample(list, [n])Parameters:list: It is the li 3 min read Underscore.js _.zip() Function The Underscore.js is a JavaScript library that provides a lot of useful functions like the map, filter, invoke etc even without using any built-in objects. The _.zip() function matches each passed array of elements to the next passed array element. It is used when more than one homogeneous arrays (o 3 min read Underscore.js _.mixin() Function Underscore.js is a JavaScript library that makes operations on arrays, string, objects much easier and handy. The _.mixin() function is used to add extra functionality and extend the global underscore object to some special utility functions. Its important to link the underscore CDN before going and 2 min read Like