Determine if product of integers is even or odd in javascript

I am trying to determine if the product of all the integers is even or odd.

I have a list of integers, and I want to check if the product of the integers is even or odd.

For example:


    function determineIfEvenOrOdd(int_array) {

    //Code here


I was thinking of looping through the array and multiplying the numbers to find out the product of the array integers. But then I thought it would be expensive to do this if the array was huge.

I am a beginner, and would like to know a possible approach for the solution.


An efficient way would be to check whether there is any number that is even, if so, the product is even. If there aren’t any numbers that are even, then the product is odd.

function isProductEven(arr) 
    for (let i = 0; i < arr.length; i++) 
        if ((arr[i] & 1) === 0) return true; 
    return false; 

console.log(isProductEven([6, 7, 9, 9]))

This outputs true as the product of these numbers is even.