Answers for "create a function that takes in an array of numbers and returns only the number that are even after 1 is added to the value"

0

create a function that takes in an array of numbers and returns only the number that are even after 1 is added to the value

const evenAfter = (arr) => {
    let i = 0
    let newArr = []
    while (i <= arr.length) {
        if ((arr[i] + 1) % 2 === 0){          
            newArr.push(arr[i])
        }  
        i++
    }
    return newArr
}

console.log(evenAfter([3,6,7,8,9,11]))
Posted by: Guest on November-17-2019

Code answers related to "create a function that takes in an array of numbers and returns only the number that are even after 1 is added to the value"

Code answers related to "Javascript"

Browse Popular Code Answers by Language