r/backtickbot • • Jun 15 '21

https://np.reddit.com/r/JavaScriptTips/comments/nzc8pn/create_your_own_javascript_function_that_can/h1vbxb4/

Or... use the built-in Array reduce method.

let max = numbers.reduce((max, curr)=>{
  return curr > max?curr:max;
}, -Infinity);
1 Upvotes

0 comments sorted by