Skip to content

Instantly share code, notes, and snippets.

@lubien
Created March 20, 2017 16:58
Show Gist options
  • Save lubien/6c53a80b466f44371c12c477f562a3c8 to your computer and use it in GitHub Desktop.
Save lubien/6c53a80b466f44371c12c477f562a3c8 to your computer and use it in GitHub Desktop.
Find the max number in an array using reduce
const max = (x, y) => x > y ? x : y
console.log([1, 2, 3, 4, 5, 6].reduce(max))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment