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

FULL DISCUSSION
 
let findOutlier = (arr) => {
  const g1 = arr.filter(x => x % 2 === 0);
  const g2 = arr.filter(x => x % 2 !== 0);
  if(g1.length > g2.length )
    return g2[0];
  else
    return g1[0];
}
code of conduct - report abuse