Tell us what’s happening:
Describe your issue in detail here.
**The globalArray variable should not change.**
const globalArray = [2, 3, 5, 6, 9];
function nonMutatingSort(arr) {
// Only change code below this line
let output = [];
output = arr.slice().sort(function(a, b) {return a-b})
arr = output;
return arr;
// Only change code above this line
}
console.log(nonMutatingSort(globalArray));
**Your browser information:**
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36
Challenge: Return a Sorted Array Without Changing the Original Array
Link to the challenge: