Tell us what’s happening:
I dont know why this code is not passing the test.
Your code so far
const globalArray = [5, 6, 3, 2, 9];
function nonMutatingSort(arr) {
// Only change code below this line
return arr.slice().sort()
// Only change code above this line
}
console.log(nonMutatingSort(globalArray));
console.log(globalArray)
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36 Edg/112.0.1722.34
Challenge: Functional Programming - Return a Sorted Array Without Changing the Original Array
Link to the challenge: