Underscore.js Chaining Methods

Index
About This Index
This page is the Underscore.js Chaining index for the tutorial track. Each row links to a full guide with syntax, examples, and FAQs.
Learn helpers on Collections and Arrays. Use this page when you want a fluent pipeline with _.chain() and .value().
Beginner path.
Start with _.chain(), call a few Underscore methods, then finish with .value() to unwrap the result.
Syntax
How to Chain Underscore Methods
Wrap with _.chain(), keep calling methods, then unwrap with .value():
Underscore
const people = [
{ name: "moe", age: 40 },
{ name: "larry", age: 50 },
{ name: "curly", age: 60 }
];
// Stay wrapped until .value()
const names = _.chain(people)
.pluck("name")
.map(function (n) { return n.toUpperCase(); })
.value();
// ["MOE", "LARRY", "CURLY"]
// Same idea via the OOP wrapper
_(people).chain().pluck("age").max().value(); // 60 Browse
Underscore.js Chaining Methods Table
All chaining guides in this Underscore.js tutorial series (2 tutorials).
Getting Started
1 methodStart a fluent pipeline with _.chain().
Unwrap
1 methodFinish the pipeline and get a plain value.
Frequently Asked Questions
Chaining wraps a value with _.chain() so Underscore methods keep returning wrappers. Call .value() at the end to get the plain array, object, or string.
Collections and Arrays teach individual helpers. This Chaining index covers the fluent pipeline tools—_.chain() to stay wrapped and .value() to unwrap.
Yes after _.chain(). Each step returns a wrapper, not the data. Skipping .value() leaves a wrapped object. _(array).map() without .chain() usually unwraps after that one method.
_(obj) is object-oriented style: one method such as .map() typically returns a plain array. _.chain(obj) (or _(obj).chain()) keeps every following method wrapped until .value().
Open _.chain() first, then .value(). Practice a short pipeline such as map → filter → value.
Start with _.chain()
Open the chaining guide—syntax, examples, and FAQs.
10 people found this page helpful
