Where to put the sort

Tell us what’s happening:

I am correctly concating the unique array values. but i dont know where the sort sort should go.

Your code so far


function uniteUnique() {
var s = arguments[0];
for (var i=1; i<arguments.length; i++) {

  s=s.concat(arguments[i].filter(function (item) {
      return s.indexOf(item) === -1;
  })).sort();
  }
  //console.log(s.sort());//not here
  return s;
}

uniteUnique([1, 3, 2], [5, 2, 1, 4], [2, 1]);

Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36.

Challenge: Sorted Union

Link to the challenge:

why do you want to sort them?

The unique numbers should be sorted by their original order, but the final array should not be sorted in numerical order.

you just need to leave their order as it is

Oh im stupid. they should have just said “you don’t need to sort them”