Tell us what’s happening:
Describe your issue in detail here.
In which sequence the processing of the methods, concat and sort, goes? Which one interpreted first?
**Your code so far**
const globalArray = [5, 6, 3, 2, 9];
function nonMutatingSort(arr) {
// Only change code below this line
return [].concat(arr).sort((a, b) => {
return a - b;
})
// Only change code above this line
}
nonMutatingSort(globalArray);
**Your browser information:**
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Firefox/102.0
Challenge: Return a Sorted Array Without Changing the Original Array
Link to the challenge: