re: Daily Challenge #81 - Even or Odd VIEW POST

FULL DISCUSSION
 

Some JavaScript

const evenVsOdd = str => {
   const evens = str.split('').filter(x => x % 2 == 0).reduce((a, b) => a + parseInt(b), 0)
   const odds = str.split('').filter(x => x % 2 != 0).reduce((a, b) => a + parseInt(b), 0)

   return evens > odds ? "Even is greater than Odd"
      : evens == odds ? "Even and Odd are the same"
      : "Odd is greater than Even"
}
code of conduct - report abuse