Underscore.js Array Complete Reference Last Updated : 23 Jul, 2025 Comments Improve Suggest changes Like Article Like Report Underscore.js is a lightweight JavaScript library and not a complete framework that was written by Jeremy Ashkenas that provides utility functions for a variety of use cases in our day-to-day common programming tasks. Array is a single variable that is used to store different elements. It is often used when we want to store list of elements and access them by a single variable. Underscore.js provides a wide range of array functions that are used to manipulate the given array values. Function Description _.first()It returns the first element of the array, i.e. the number at the zeroth index. _.initial()It excludes the last element from the array. _.last()It is used to display the last element of the array. _.rest()It returns the rest of the elements except the zeroth indexed element. _.compact()It returns an array after removing all the false values. _.flatten()It is used to flatten an array which is nested to some level. _.without()It returns a copy of array which contains all the array except values. _.union()It takes n number of arrays and return a new array with the unique terms in all those arrays. _.intersection()It is used to find the intersection of passed arrays. _.difference()It returns the values of array that are not present in the other arrays. _.uniq()It returns the array which does not contain duplicate elements. _.zip()It matches each passed array of elements to the next passed array element. _.unzip()It combines the same type of elements of different arrays into a single array. _.object()It It converts the array elements into objects. _.chunk()It converts a single array into a number of arrays. _.indexOf()It gives the index of the elements whose position we need to find. _.lastIndexOf()It finds the index of an element in an array. _.sortedIndex()It decides where the new element you want to insert into the passed array. _.findIndex()It finds the index of an element which is passed in the second parameter. _.findLastIndex()It finds the position of the element in an array starting from the end of the array. _.range()It prints the list of elements from the start given as a parameter to the end also a parameter. Create Quiz Comment K kartik Follow 0 Improve K kartik Follow 0 Improve Article Tags : JavaScript Web Technologies JavaScript - Underscore.js Explore JavaScript BasicsIntroduction to JavaScript4 min readVariables and Datatypes in JavaScript6 min readJavaScript Operators5 min readControl Statements in JavaScript4 min readArray & StringJavaScript Arrays7 min readJavaScript Array Methods7 min readJavaScript Strings5 min readJavaScript String Methods9 min readFunction & ObjectFunctions in JavaScript5 min readJavaScript Function Expression3 min readFunction Overloading in JavaScript4 min readObjects in JavaScript4 min readJavaScript Object Constructors4 min readOOPObject Oriented Programming in JavaScript3 min readClasses and Objects in JavaScript4 min readWhat Are Access Modifiers In JavaScript ?5 min readJavaScript Constructor Method7 min readAsynchronous JavaScriptAsynchronous JavaScript2 min readJavaScript Callbacks4 min readJavaScript Promise4 min readEvent Loop in JavaScript4 min readAsync and Await in JavaScript2 min readException HandlingJavascript Error and Exceptional Handling6 min readJavaScript Errors Throw and Try to Catch2 min readHow to create custom errors in JavaScript ?2 min readJavaScript TypeError - Invalid Array.prototype.sort argument1 min readDOMHTML DOM (Document Object Model)8 min readHow to select DOM Elements in JavaScript ?3 min readJavaScript Custom Events4 min readJavaScript addEventListener() with Examples9 min readAdvanced TopicsClosure in JavaScript4 min readJavaScript Hoisting6 min readScope of Variables in JavaScript3 min readJavaScript Higher Order Functions7 min readDebugging in JavaScript4 min read Like