Tell us what’s happening:
nonMutatingSort(globalArray) should return [2, 3, 5, 6, 9]
My exercise tell me that and this is wrong.Can you tell me where is my wrong?
Your code so far
var globalArray = [5, 6, 3, 2, 9];
function nonMutatingSort(arr) {
// Add your code below this line
var globalArray = [5,6,3,2,9];
function nonMutationSort(arr) {
return [].concat(arr).sort( (a,b) => a > b );
}
// Add your code above this line
}
nonMutatingSort(globalArray);
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/functional-programming/return-a-sorted-array-without-changing-the-original-array