Javascript

Given an array,print the sum of the even and odd numbers in the array.Javascript Program

const number=[3,4,5,12];
let sum=0;
let sum1=0;
for(let i=0;i<number.length;i++)
{
    if(number[i]%2==0)
    {
      sum=sum+number[i];
      
    }
    else if(number[i]%2==1)
    {
      sum1=sum1+number[i];
    }
    
}
console.log('Even Sum='+sum);
console.log('Odd Sum='+sum1);