55.partitionArray

Write a function named partitionArray that receives 2 parameters:

  • an Array of numbers - numbers
  • a function that receives a number as parameter and returns a boolean - predicateCallback

The function should return an Object with 2 properties:

  • pass - an Array with all the numbers that pass the test implemented by the predicateCallback
  • fail - an Array with all the numbers that do not pass the test implemented by the predicateCallback

NOTE: the order of the numbers in the pass and fail arrays should be the same as in the numbers array

Example 1

Input

numbers

=

predicateCallback

=
(nr) => nr % 2 === 0

Output