Check if the XOR of an array of integers is Even or Odd | Function to check if the XOR of an array of integers is Even or Odd ; Count the number of odd elements ; If count of odd elements is odd , then XOR will be odd ; Else even ; Driver Code ; Function call
function check ( arr , n ) { let count = 0 ; for ( let i = 0 ; i < n ; i ++ ) { if ( arr [ i ] & 1 ) count ++ ; } if ( count & 1 ) return " " ; else return " " ; } let arr = [ 3 , 9 , 12 , 13 , 15 ] ; let n = arr . length ; document . write ( check ( arr , n ) ) ;