Implement a function minBy(array, iteratee) that finds the element inside array with the minimum value returned by iteratee.
minBy(array, iteratee)
array
iteratee
(*): Returns the element whose iteratee result is the minimum.
(*)
minBy([2, 3, 1, 4], (num) => num); // => 1 minBy([{ n: 1 }, { n: 2 }], (o) => o.n); // => { n: 1 }
The function should ignore elements where iteratee produces null or undefined.
null
undefined
minBy([{ n: 1 }, { n: 2 }], (o) => o.m); // => undefined
_.minBy
console.log()