Skip to content

Instantly share code, notes, and snippets.

@thauber
Created May 19, 2020 19:33
Show Gist options
  • Save thauber/20212daf6c2a0c562557cdd23116e990 to your computer and use it in GitHub Desktop.
Save thauber/20212daf6c2a0c562557cdd23116e990 to your computer and use it in GitHub Desktop.
const info = _.reduce(list (memo, item) => {
if (item.data > memo.max.data) memo.max = item
if (item.data < memo.min.data) memo.min = item
return memo
})
console.log(infom.max) // item with max .data
console.log(info.min) //item with min .data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment