Sorted union problem

Sorted union problem
0

#1

Tell us what’s happening:
Hello, I’m having trouble ‘compiling’ my solution on fcc. I’ve tested my solution localy, but it doesn’t seem to work on fcc.

Your code so far

function uniteUnique(…arr) {
let sett=new Set();
arr.forEach(arrays=>{
for(let i=0;i<arrays.length;i++)
sett.add(arrays[i]);
});
return sett;
}

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

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:62.0) Gecko/20100101 Firefox/62.0.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/sorted-union


#2

The … in your rest operator is some character native to your computer, not just three dots. Maybe a tablet or a Mac thing. Maybe you are using a word processor, not a editor = just guessing. In FCC editor delete that and type it in fresh. It should work correctly after that.

Also, you will need to convert your Set back to an array before you return it. The answer is to be an array.


#3

Oh thank you ! I forgot to return it as array D: