Challenge: Filter Even and Odd Numbers
This lesson brings you a challenge to solve.
We'll cover the following
Problem statement
Rework the example from the previous lesson so that you only need the isEven
function and the filter
function that returns the even and odd slices together.
Input
A single slice of integers.
Output
Two slices of integers: one having only odd numbers and second having only even numbers
Sample input
{1,2,3,4,5,7}
Sample output
[1,3,5,7] // odd integers
[2,4] // even integers
Try to implement the function below. Feel free to view the solution, after giving some shots. Good Luck!
Get hands-on with 1400+ tech skills courses.