re: Daily Challenge #35 - Find the Outlier VIEW POST

FULL DISCUSSION
 
function findOutlier(integers){
  let oddCount = 0, evenCount = 0, r1 = 0, r2 = 0
  integers.forEach((i)=>{
   if(i % 2 == 0) {evenCount++; r1 = i;}
   else if(Math.abs(i % 2) == 1) {oddCount++; r2 = i;}
  })
  return (evenCount>oddCount)?r2:r1
}
code of conduct - report abuse