Day 46/100: Playing with CodeWars some more

Played around with CodeWars and some of the problems on there. Here's one of the solutions I came up with for a question to determine an outlier in the array (eg: one of the elements would be either odd or even).

function findOutlier(integers){
    let odd = integers.filter(function(n) {return (n%2) !== 0;});
    let even = integers.filter(function(n) {return (n%2) === 0;});

    if (odd.length < even.length) {
        return odd[0];
    } else {
        return even[0];
    }
}

links

social