Also known as inject and foldl, reduce boils a list of values down to a single value. Memo is the initial state; each step returns the next memo (official Underscore docs). Stable Collection helper — not deprecated.
Pass the required arguments shown below. Underscore collection helpers usually return a new value — check whether the source is mutated.
Syntax
Call _.reduce. Start with this line.
Underscore
_.reduce(list, iteratee, [memo])
Call
What it does
_.reduce(list, iteratee, [memo])
Primary signature.
_.reduce(...)
Call with the arguments your case needs.
Load Underscore with import _ from "underscore" (or the UMD CDN build) so these helpers are available as _.
Concat each pair. Append [0,1], then [2,3], then [4,5].
New arrays.concat returns a fresh array each step.
Left order. For right-to-left flatten, see _.reduceRight.
Compatibility
Browser & Runtime Support
_.reduce 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
_.reduce()
Available in [email protected] (UMD / ESM). Works in evergreen browsers and current Node LTS when Underscore is loaded. Aliases inject / foldl included.
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
_.reduceUnderscore 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]). Native alternative: Array.prototype.reduce on real arrays.
Frequently Asked Questions
_.reduce(list, iteratee, [memo], [context]) boils a list down to a single value. Memo is the running accumulator; each step returns the next memo. Also known as inject and foldl.
No. inject and foldl are aliases of reduce — same function, different names.
Four: memo, value, index (or key), and the full list — (memo, value, index, list) for arrays.
The first element becomes the starting memo, and the iteratee begins on the second element.
_.map returns one result per item (a new array). _.reduce combines everything into one accumulated value.
When you need to fold from last to first. For left-to-right accumulation, stick with _.reduce.