Get union of arrays
JavaScript
const union = (...arr) => [...new Set(arr.flat())]TypeScript
const union = <T,_>(...arr: T[][]): T[] => [...new Set(arr.flat())]Example
union([1, 2], [2, 3], [3]) // [1, 2, 3]const union = (...arr) => [...new Set(arr.flat())]const union = <T,_>(...arr: T[][]): T[] => [...new Set(arr.flat())]union([1, 2], [2, 3], [3]) // [1, 2, 3]