I have a question on my code, it’s the one line return I use and the one below. What is the Difference, if any?
var globalArray = [5, 6, 3, 2, 9];
function nonMutatingSort(arr) {
// Add your code below this line
return arr.concat().sort((a, b) => a - b);
// Add your code above this line
}
or using:
return [].concat(arr).sort((a, b) => a - b);
I passed the challenge with the first one, just trying to understand concat() on a deeper level.