Lodash _.partial() Method

Beginner
5 min read
Updated: Nov 2026
5 examples
Function

Definition

Creates a function that invokes func with partials prepended to the arguments it receives. Like _.bind, but it does not alter the this binding. Part of Lodash 4.x Function (since 0.2.0).

Pass the required arguments shown below. Most helpers return a new function you call later.

Syntax

Call _.partial. Start with this line.

Lodash
_.partial(func, [partials])
CallWhat it does
_.partial(func, [partials])Primary signature.
_.partial(func)Wrap or transform a function.

Prefer import partial from "lodash/partial" when you want a smaller bundle.

Library declarations
Lodash
_.partial(func, [partials])

Parameters

ParameterDescription
funcRequired. Function to partially apply
partialsOptional. Leading values and/or placeholders

Return Value

Return ValueDescription
*New wrapper function

Lodash Examples

Example 1 — Official: Fix the Greeting

Lock the first argument; pass the name when calling.

Lodash
function greet(greeting, name) {
  return greeting + " " + name;
}

var sayHelloTo = _.partial(greet, "hello");
sayHelloTo("fred");
// → "hello fred"
Try It Yourself

How It Works

  1. Partial. "hello" is stored as the first argument.
  2. Call. sayHelloTo("fred") supplies the second.
  3. Invoke. Lodash runs greet("hello", "fred").
  4. Result. "hello fred".

Example 2 — Official: Placeholder Slot

Skip the first slot with _; fix the name instead.

Lodash
function greet(greeting, name) {
  return greeting + " " + name;
}

var greetFred = _.partial(greet, _, "fred");
greetFred("hi");
// → "hi fred"
Try It Yourself

How It Works

  1. Placeholder. _ marks an open first argument.
  2. Fixed. "fred" is locked as name.
  3. Fill. greetFred("hi") fills the _ slot.
  4. Modular. Use _.partial.placeholder if _ is unavailable.

Example 3 — Fix More Than One Argument

Prepend several values at once.

Lodash
function log(level, tag, msg) {
  return "[" + level + "][" + tag + "] " + msg;
}

var infoApp = _.partial(log, "INFO", "app");
infoApp("started");
// → "[INFO][app] started"
Try It Yourself

How It Works

  1. Two partials. Level and tag are fixed.
  2. Call. Only the message is supplied later.
  3. Merge. Args become ("INFO", "app", "started").
  4. Use case. Specialized loggers, API clients, config injectors.

Example 4 — partial vs partialRight

Same greet function — leading vs trailing fix.

Lodash
function greet(greeting, name) {
  return greeting + " " + name;
}

_.partial(greet, "hello")("fred");
// → "hello fred"

_.partialRight(greet, "fred")("hello");
// → "hello fred"
Try It Yourself

How It Works

  1. partial. Fixes greeting; you pass name.
  2. partialRight. Fixes name; you pass greeting.
  3. Same output. Different which side is locked.
  4. Pick. Prefer the helper that matches which args are stable.

Example 5 — Build a Specialized Adder

Create add10 by fixing the first operand.

Lodash
function add(a, b) {
  return a + b;
}

var add10 = _.partial(add, 10);
add10(5);
// → 15

add10(7);
// → 17
Try It Yourself

How It Works

  1. Fix. a is always 10.
  2. Call. Pass only b.
  3. Reuse. Same wrapper works for many values of b.
  4. Note. Unlike curry, you are not chaining — one wrapper, then call.

Browser & Runtime Support

_.partial is a Lodash 4.x Function helper (since 0.2.0). It runs anywhere Lodash runs — modern browsers (CDN or bundle) and Node.js / Bun / Deno with npm install lodash. Native Function.prototype.bind can also fix leading args but always binds this; Lodash partial leaves this alone and adds placeholders.

✓ Stable · Lodash 4.x

_.partial()

Available in [email protected] full builds and the lodash/partial modular import. Works in evergreen browsers and current Node LTS when Lodash is installed.

100% With Lodash 4.x
Google Chrome Supported · Desktop & Mobile
Full support
Mozilla Firefox Supported · Desktop & Mobile
Full support
Apple Safari Supported · macOS & iOS
Full support
Microsoft Edge Supported · Chromium
Full support
Internet Explorer No native support · Use a polyfill
Polyfill
Opera Supported · Modern versions
Full support
Samsung Internet Supported · Android
Full support
Bun Supported · JavaScript runtime
Supported
Deno Supported · JavaScript runtime
Supported
Node.js Supported · Server runtime
Supported
Android WebView Supported · Modern WebView
Full support
_.partial Lodash 4.x+

Bottom line: Safe for production once Lodash is loaded. Prefer import partial from "lodash/partial" for smaller builds. Ideal for specialized helpers, config injection, and reusable call adapters.

Frequently Asked Questions

_.partial(func, ...partials) returns a function that invokes func with those partials prepended to later call arguments. It does not change this.
_.partial.placeholder (or _ in full builds) marks a slot to fill later. Later call arguments fill placeholders in order.
bind sets this (and can also fix args). partial only fixes arguments and leaves this alone.
partial fixes leading args. partialRight fixes trailing args.
partial fixes values once and returns a ready-to-call function. curry returns a chain of functions until arity is met.
Use import partial from "lodash/partial" or require("lodash/partial"). Placeholders: partial.placeholder.

Next: _.partialRight()

Pre-fill trailing arguments — the right-side twin of partial.

_.partialRight() tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

10 people found this page helpful