function uniteUnique(...arr) {
let full=[];
for(let keys of arr){
full.push(...keys);
}
return [...new Set(full)];
}
uniteUnique([1, 3, 2], [5, 2, 1, 4], [2, 1]);
Hi guru, welcome to the forum.
Could you provide some context? Which challenge is this code solving? Why, and compared to what, is it remarkably simple?
PS: I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.
Please use the “preformatted text” tool in the editor (</>
) to add backticks around text.
See this post to find the backtick on your keyboard.
Note: Backticks are not single quotes.