Creates a new array by running each element of a collection through an iteratee. Works on arrays and plain objects (object iteration order is not guaranteed). The iteratee receives (value, index|key, collection). Part of Lodash 4.x Collection.
Pass the required arguments shown below. Lodash Collection helpers usually return a new value — check whether the source is mutated.
Syntax
Call _.map on a collection. Start with this line.
Lodash
_.map(collection, [iteratee=_.identity])
Call
What it does
_.map(collection, [iteratee=_.identity])
Primary signature.
_.map(collection)
Call with a collection argument.
Prefer import map from "lodash/map" when you want a smaller bundle.
Library declarations
Lodash
_.map(collection, [iteratee=_.identity])
Parameters
Parameter
Description
collection
Required. Array or object to iterate
iteratee
Optional. Transform; default _.identity
Return Value
Return Value
Description
*
New array of mapped values
Lodash Examples
Example 1 — Official: Square Numbers
Map each array value through a function.
Lodash
function square(n) {
return n * n;
}
_.map([4, 8], square);
// → [16, 64]
Objects. On plain objects, the second arg is the key name.
Compatibility
Browser & Runtime Support
_.map is a Lodash 4.x Collection helper. It runs anywhere Lodash runs — modern browsers (CDN or bundle) and Node.js / Bun / Deno with npm install lodash. Native Array.prototype.map covers arrays only.
✓ Stable · Lodash 4.x
_.map()
Available in [email protected] full builds and the lodash/map modular import. Works in evergreen browsers and current Node LTS when Lodash is installed.
100%With Lodash 4.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
_.mapLodash 4.x+
Bottom line: Safe for production once Lodash is loaded. Prefer import map from "lodash/map" for smaller builds. Use native Array.map for array-only modern code.
Frequently Asked Questions
_.map(collection, iteratee) runs each element through iteratee and returns a new array of results.
No. It returns a new array. Your iteratee can still mutate nested objects if you change them.
_.map always returns an array. To keep object keys with new values, use _.mapValues.
flatMap maps then flattens one level — use it when each iteratee returns an array you want to merge.
Yes. Pass a string like "user" as the iteratee shorthand to pluck that property.
(value, index|key, collection) — three arguments, like Array.prototype.map.