Good day, can you see the problem with my code? Thank you!
**Your code so far**
var globalArray = [5, 6, 3, 2, 9];
function nonMutatingSort(arr) {
// Only change code below this line
let emptyStr = [];
let newStr = emptyStr.concat(globalArray);
return newStr.sort((a, b) => {
return a - b;
});
// Only change code above this line
}
console.log(nonMutatingSort([140000, 104, 99]));
// concat an empty array to the one being sorted
// run sort on new array
**Your browser information:**
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.182 Safari/537.36
.
Challenge: Return a Sorted Array Without Changing the Original Array
Link to the challenge: