Example 1 — Official: Invoke sort
Call the same method name on every item and collect the returns.
_.invoke([[5, 1, 7], [3, 2, 1]], "sort");
// → [[1, 5, 7], [1, 2, 3]] How It Works
- Method name.
"sort"means call.sort()on each value. - First array.
[5,1,7]becomes[1,5,7]. - Second array.
[3,2,1]becomes[1,2,3]. - Return. New outer array of those results — and the inners are mutated.

