Example 1 — Even and Odd Numbers
A function predicate puts even numbers in the first bucket.
_.partition([1, 2, 3, 4], function (n) {
return n % 2 === 0;
});
// → [[2, 4], [1, 3]] How It Works
- Source. Numbers
1…4. - Test.
n % 2 === 0is truthy for evens. - Pass bucket.
2and4land in index0. - Fail bucket. Odds stay in index
1, in original order.

