Answers for "Return a sorted array without mutating the original array JS Javascript Free Code Camp FCC"

0

Return a sorted array without mutating the original array JS Javascript Free Code Camp FCC

var globalArray = [5, 6, 3, 2, 9];
function nonMutatingSort(arr) {
  // Add your code below this line
  return [].concat(arr).sort(function(a, b) {
    return a - b;
  });
  // Add your code above this line
}
nonMutatingSort(globalArray);
Posted by: Guest on April-24-2021

Code answers related to "Return a sorted array without mutating the original array JS Javascript Free Code Camp FCC"

Browse Popular Code Answers by Language