Q:

Write a JavaScript program to get every element that exists in any of the two arrays once

0

Write a JavaScript program to get every element that exists in any of the two arrays once.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

const union = (a, b) => Array.from(new Set([...a, ...b]));
console.log(union([1, 2, 3], [4, 3, 2]));
console.log(union([1, 2, 3], [1, 2, 3]));

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now