Function binding
Function binding is the creation of a function with a predetermined this value and, optionally, preset arguments.
Functional Programming in JavaScript
The technique of associating a function with a specific this value or preset arguments so it can be invoked in a controlled context.
- How it is used
- Uses preset arguments to turn general functions into modular, reusable operations.
- How deep it goes
- Defines binding, contrasts it with currying and partial application, and demonstrates configured callbacks without detailing binding internals.
- Examples
- Demonstrates a bound logger, partially configured string methods, and scheduled callbacks.
- What you can do after
- Apply it via Lodash _.bind or JavaScript Function.prototype.bind to create configured functions.
Read how Functional Programming in JavaScript explains function binding →
The Joy of JavaScript
The JavaScript method that creates a new function with a bound this value and optional leading arguments.
- How it is used
- Uses bind to repair a method's this reference while composing functions around object state.
- How deep it goes
- Explains context correction, partial argument application, and maintainability tradeoffs before shifting to explicit parameters.
- Examples
- Uses assemble.bind(this, keys) inside calculateHash and contrasts it with assemble(keys, obj).
- What you can do after
- Apply it via JavaScript's bind method to preserve object context and prefill keys, while recognizing its maintainability cost.
Also covered in
- Secrets of the JavaScript Ninja, Third EditionIn early access (MEAP)
- Build a Frontend Web Framework (From Scratch)
- Secrets of the JavaScript Ninja, Second Edition
- Essential TypeScript 5, Third Edition
- JavaScript in DepthIn early access (MEAP)
What to know first
- functionA function is a callable unit of program code that performs a computation or operation, can accept inputs, and may produce a result or side effect.
- thisIn JavaScript, the this value is determined by a function’s call context or, for an arrow function, inherited lexically.
- arrow functionAn arrow function is a JavaScript function expression written with arrow syntax that uses lexical binding for this and has no own arguments object.
Related concepts
- thisconfigures · In JavaScript, the this value is determined by a function’s call context or, for an arrow function, inherited lexically.
- arrow functioncontrasts with · An arrow function is a JavaScript function expression written with arrow syntax that uses lexical binding for this and has no own arguments object.
- functionproduces · A function is a callable unit of program code that performs a computation or operation, can accept inputs, and may produce a result or side effect.
- execution contextconfigures · An execution context is the runtime environment and associated state that govern how a computation executes, including its bindings, resources, or scheduling.
Questions about function binding
What is function binding?
Function binding is the creation of a function with a predetermined this value and, optionally, preset arguments.
Which Manning books explain function binding?
Functional Programming in JavaScript and The Joy of JavaScript.
What should I know before learning function binding?
Manning books that teach function binding usually introduce function, this and arrow function first.
What is the difference between function binding and arrow function?
Function binding is the creation of a function with a predetermined this value and, optionally, preset arguments. An arrow function is a JavaScript function expression written with arrow syntax that uses lexical binding for this and has no own arguments object.
What is function binding also called?
Function binding is also called bind.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

