Partially apply a function by filling in any number of its arguments, without changing its dynamic this — a close cousin of _.bind (official Underscore docs). Stable Function helper — not deprecated.
Pass the required arguments shown below. Underscore function helpers usually return a new function — check timing and call-count behavior carefully.
Syntax
Call _.partial. Start with this line.
Underscore
_.partial(fn, *arguments)
Call
What it does
_.partial(fn, *arguments)
Primary signature.
_.partial(...)
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
_.partial(fn, *arguments)
Parameters
Parameter
Description
function
Required. Function to partially apply
*arguments
Optional. Pre-filled values and/or _ gaps
Return Value
Return Value
Description
*
New specialised function
Underscore.js Examples
Example 1 — Pre-fill the First Argument
Official docs pattern — lock a to 5.
Underscore
var subtract = function (a, b) { return b - a; };
var sub5 = _.partial(subtract, 5);
sub5(20);
// → 15
Map calls. Each value is passed as the next argument.
Result.2*1, 2*2, 2*3.
No wrapper. You avoid writing n => multiply(2, n).
Compatibility
Browser & Runtime Support
_.partial 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
_.partial()
Available in [email protected] (UMD / ESM). Works in evergreen browsers and current Node LTS when Underscore is loaded. Placeholder _ supported.
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
_.partialUnderscore 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: (...rest) => fn(fixed, ...rest) or Function.prototype.bind when you also need this.
Frequently Asked Questions
_.partial(function, *arguments) returns a new function with some arguments already filled in. Call-time arguments are supplied for the remaining positions.
Pass _ (the Underscore object) as a placeholder for an argument that should stay open until call time.
No. It only pre-fills arguments and leaves this dynamic. Use _.bind when you also need to fix this.
_.bind sets this (and can pre-fill args). _.partial only pre-fills args and never touches this.
No. It returns a new function; the original is unchanged.