Skip to content

Latest commit

 

History

History

evenNumbersInAnArray

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Even numbers in an array

7 kyu link to kata
my solution

Given an array of numbers, return a new array of length number containing the last even numbers from the original array (in the same order). The original array will be not empty and will contain at least "number" even numbers.

For example:

([1, 2, 3, 4, 5, 6, 7, 8, 9], 3) => [4, 6, 8]
([-22, 5, 3, 11, 26, -6, -7, -8, -9, -8, 26], 2) => [-8, 26]
([6, -25, 3, 7, 5, 5, 7, -3, 23], 1) => [6]