Lodash _.bind() Method

Beginner
5 min read
Updated: Nov 2026
5 examples
Function

Definition

Creates a function that invokes func with the this binding of thisArg and partials prepended to the arguments it receives. Part of Lodash 4.x Function (since 0.1.0).

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

Syntax

Call _.bind. Start with this line.

Lodash
_.bind(func, thisArg, …partials)
CallWhat it does
_.bind(func, thisArg, …partials)Primary signature.
_.bind(func)Wrap or transform a function.

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

Library declarations
Lodash
_.bind(func, thisArg, …partials)

Parameters

ParameterDescription
funcRequired. Function to bind
thisArgRequired. Value of this inside func
partialsOptional. Leading arguments (or placeholders)

Return Value

Return ValueDescription
*New bound function

Lodash Examples

Example 1 — Official this + Partial

Lock the object and the greeting; pass punctuation later.

Lodash
function greet(greeting, punctuation) {
  return greeting + " " + this.user + punctuation;
}

var object = { user: "fred" };
var bound = _.bind(greet, object, "hi");

bound("!");
// → "hi fred!"
Try It Yourself

How It Works

  1. thisArg. object becomes this inside greet.
  2. Partial. "hi" is stored as the first argument.
  3. Call. bound("!") appends "!" as punctuation.
  4. Result. Same string as the official Lodash docs.

Example 2 — Placeholder Slot

Skip an early argument and fill it when the bound function runs.

Lodash
function greet(greeting, punctuation) {
  return greeting + " " + this.user + punctuation;
}

var object = { user: "fred" };
var bound = _.bind(greet, object, _, "!");

bound("hi");
// → "hi fred!"
Try It Yourself

How It Works

  1. Slot. _ marks “fill greeting later” (full Lodash build).
  2. Fixed. "!" is already bound as punctuation.
  3. Call. bound("hi") drops into the placeholder.
  4. Modular. Use _.bind.placeholder (or bind.placeholder) instead of _.

Example 3 — Fix this Only

Bind the context without pre-filling arguments.

Lodash
function fullName() {
  return this.first + " " + this.last;
}

var person = { first: "Ada", last: "Lovelace" };
var nameOf = _.bind(fullName, person);

nameOf();
// → "Ada Lovelace"
Try It Yourself

How It Works

  1. Context. person is locked as this.
  2. No partials. Every call argument (if any) is forwarded as-is.
  3. Safe. Passing nameOf as a callback keeps the same this.
  4. Native twin. fullName.bind(person) is similar here — without Lodash placeholders.

Example 4 — Multiple Partials

Prepend more than one leading argument.

Lodash
function tag(a, b, c) {
  return [a, b, c, this.user].join("-");
}

var object = { user: "fred" };
var bound = _.bind(tag, object, "x", "y");

bound("z");
// → "x-y-z-fred"
Try It Yourself

How It Works

  1. Store. "x" and "y" are fixed up front.
  2. Append. bound("z") supplies c.
  3. this. this.user still comes from object.
  4. Order. Partials always come before call-time args (unless placeholders rearrange slots).

Example 5 — bind vs partial

Same leading args — only bind sets this.

Lodash
function label(prefix) {
  return prefix + ":" + this.id;
}

var obj = { id: 7 };
var withThis = _.bind(label, obj, "item");
var noThis = _.partial(label, "item");

withThis(); // → "item:7"
noThis();   // → "item:undefined" (this is not obj)
Try It Yourself

How It Works

  1. bind. Fixes this to obj and prepends "item".
  2. partial. Only prepends "item" — this follows the call site.
  3. Pick. Need context → bind. Args only → partial.
  4. Methods. For object[key] that may change later, see _.bindKey.

Browser & Runtime Support

_.bind is a Lodash 4.x Function helper (since 0.1.0). It needs no special browser APIs beyond loading Lodash.

✓ Stable · Lodash 0.1.0+

_.bind()

Available in [email protected] full builds and the lodash/bind modular import. Works in evergreen browsers and Node / Bun / Deno 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
_.bind Lodash 4.x+

Bottom line: Safe for production once Lodash is on the page or in your bundle. Prefer import bind from "lodash/bind" for smaller builds. Remember: bound.length is not set (unlike native bind).

Frequently Asked Questions

_.bind(func, thisArg, ...partials) returns a function that calls func with a fixed this and any partials prepended to later arguments.
Both fix this and can prepend arguments. Lodash supports placeholders to skip slots. Native bind sets the bound function’s length; Lodash bind does not.
A sentinel (often _ in the full Lodash build) marking argument positions to fill when the bound function runs. In modular imports use bind.placeholder.
Use partial when you only need leading arguments and do not need to set this. Use bind when thisArg matters.
No. It returns a new wrapper; the original func stays unchanged.
Use import bind from "lodash/bind" then bind.placeholder for deferred slots. Full build: import _ from "lodash" then _.bind.

Next: _.bindKey()

Bind a method by name so later replacements on the object are picked up.

_.bindKey() 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