Produces a new array of values by mapping each value in list through a transformation function (iteratee). The iteratee receives (value, index|key, list) (official Underscore docs).
Pass the required arguments shown below. Underscore collection helpers usually return a new value — check whether the source is mutated.
Syntax
Call _.map. Start with this line.
Underscore
_.map(list, iteratee, [context])
Call
What it does
_.map(list, iteratee, [context])
Primary signature.
_.map(...)
Call with the arguments your case needs.
Load Underscore with import _ from "underscore" (or the UMD CDN build) so these helpers are available as _.
Library declarations
Underscore
_.map(list, iteratee, [context])
Parameters
Parameter
Description
list
Required. Array, array-like, or plain object
iteratee
Required. Function (or property string) that returns the new value
context
Optional. this for the iteratee
Return Value
Return Value
Description
*
New array of transformed values
Underscore.js Examples
Example 1 — Official: Transform Numbers
Return a new value for each item; collect them into an array.
Underscore
_.map([1, 2, 3], function (num) {
return num * 3;
});
// → [3, 6, 9]
vs pluck. Same idea as _.pluck(people, "name") for this case.
Custom? Need more than one field → use a function iteratee.
Compatibility
Browser & Runtime Support
_.map / _.collect ships with Underscore.js (1.x). It runs anywhere Underscore runs — modern browsers (CDN or bundle) and Node.js / Bun / Deno with npm install underscore.
✓ Stable · Underscore 1.x
_.map()
Available in [email protected] (UMD / ESM). Works in evergreen browsers and current Node LTS when Underscore is loaded.
100%With Underscore 1.x
Google ChromeSupported · Desktop & Mobile
Full support
Mozilla FirefoxSupported · Desktop & Mobile
Full support
Apple SafariSupported · macOS & iOS
Full support
Microsoft EdgeSupported · Chromium
Full support
Internet ExplorerNo native support · Use a polyfill
Polyfill
OperaSupported · Modern versions
Full support
Samsung InternetSupported · Android
Full support
BunSupported · JavaScript runtime
Supported
DenoSupported · JavaScript runtime
Supported
Node.jsSupported · Server runtime
Supported
Android WebViewSupported · Modern WebView
Full support
_.mapUnderscore 1.x+
Bottom line: Safe for production once Underscore is on the page or in your bundle. Not a native browser API — load Underscore first. Prefer a pinned CDN version (e.g. [email protected]).
Frequently Asked Questions
_.map(list, iteratee, [context]) produces a new array by transforming each value in list through the iteratee. It works on arrays and plain objects, and always returns an array — the original collection is unchanged.
collect is an alias of map — the same function. Use whichever name your team prefers.
Three arguments: value, then index (or key), then the whole list — (value, index, list) for arrays and (value, key, list) for objects.
_.each runs a callback for side effects and returns the original list. _.map collects each return value into a new array — use it when you need transformed data.
Yes. It iterates the object’s values and still returns a flat array of results — keys are not preserved in the output.
Yes. A string like 'name' acts as a property shorthand — _.map(list, 'name') is like plucking that field from each item.