Write a function named partitionArray that receives 2 parameters:
numberspredicateCallbackThe function should return an Object with 2 properties:
pass - an Array with all the numbers that pass the test implemented by the predicateCallbackfail - an Array with all the numbers that do not pass the test implemented by the predicateCallbackNOTE: the order of the numbers in the
passandfailarrays should be the same as in thenumbersarray
numbers
=predicateCallback
=(nr) => nr % 2 === 0
Unlock all functions
The first 10 functions are free. Get lifetime access to all 100 with a one-time payment — no subscription.
Upgrade to Pro