HackerRank- Mini-Max Sum (easy)

Link to code challenge
function miniMaxSum(arr) { let newArr = arr.sort((a, b) => a - b); let lowest = newArr.slice(0, newArr.length - 1).reduce((a, b) => a + b); let highest = newArr.slice(1).reduce((a,b) => a + b); console.log(lowest, highest); }

Comments

Popular posts from this blog

Code Wars: String incrementer

Code Wars: Find the odd int

Udemy JS Algorithms & Data Structures Masterclass- Section 6 Exercise 8 (1st try)