Sequence on processing methods

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

  **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:

You’re calling concat on the empty array [], and then calling sort on the return value of that. So, concat then sort.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.