Underscore.js _.map() Function (original) (raw)

Last Updated : 26 Oct, 2022

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 to produce a new array of values by mapping each value in list through transformation function (iterate). It displays the result as a list on the console. In this list the output of the first element, i.e, the element at index 0 has it’s result at index 0 of the returned list and when all the elements of the list are passed to the function/iterate and no more elements remain then the _.map loop ends. Syntax:

_.map(list, function)

Parameters: It accepts two parameters which are specified below-

Return values: It returns the object property value or array element value at the current position.

html

html

html

html

html

Similar Reads

Underscore.js Collections Functions
















Underscore.js Arrays Functions
















Underscore.js Functions















Underscore.js Object Functions
















Underscore.js Utility Functions















Underscore.js Questions