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: