Question: in JavaScript no regex . Write a function called countEvenOdd that uses the .reduce() method The countEvenOdd function MUST use the .reduce() method The countEvenOdd

in JavaScript no regex

. Write a function called countEvenOdd that uses the .reduce() method

The countEvenOdd function MUST use the .reduce() method

The countEvenOdd accepts an array of numbers and a string argument that is either "even" or "odd"

The countEvenOdd function then returns the total count of the even or odd numbers in the array

Example:

countEvenOdd([1, 33, 20, 19, 99, 54, 78, 68, 5, 2, 0, 202], 'odd');

OUTPUT (number): 5

countEvenOdd([1, 33, 20, 19, 99, 54, 78, 68, 5, 2, 0, 202], 'even');

OUTPUT (number): 7

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!