Example 1 — Official: Map with Dot Path
Invoke the same nested method on every object in a list.
var objects = [
{ 'a': { 'b': _.constant(2) } },
{ 'a': { 'b': _.constant(1) } }
];
_.map(objects, _.method('a.b'));
// → [2, 1] How It Works
- Setup. Each object has a nested function at
a.b(via_.constant). - Invoker.
_.method('a.b')means “callobject.a.b().” - Map. Runs that invoker on every item.
- Result.
[2, 1]— return values of each call.

