0

I am not allowed to use Math.max() or Math.min() to solve this problem

const findMinAndMax = function(list) {
  let orderedList = list.sort();
  let min = orderedList[0];
  let max = orderedList[orderedList.length - 1];
  return [min, max];
}; 

// [1, 100, 2, 200, 300, 3] answer [1, 300] 
// [9, -9, 10, -10] answer is supposed to be [-10, 10] but i get [-10, 9]
kardib09
  • 1
  • 2

0 Answers0