Loading problem…
Implement a partition function that splits an array into two groups based on a predicate function.
partition([1, 2, 3, 4, 5], n => n % 2 === 0);
// Returns: [[2, 4], [1, 3, 5]]
partition(['apple', 'banana', 'cherry'], s => s.length > 5);
// Returns: [['banana', 'cherry'], ['apple']]