Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

union of two arrays javascript

// union of two arrays javascript (duplicate)
const union = (a, b) => Array.from(new Set([...a, ...b]));
console.log(union([1, 2, 3], [4, 3, 2]))
// output
 // [1, 2, 3, 4]
 
PREVIOUS NEXT
Tagged: #union #arrays #javascript
ADD COMMENT
Topic
Name
3+2 =