Set of elements that are either in A or B! Union should not contain one element twice.

function union(arr1, arr2) {
    let result = arr1;
    arr2 = arr2.filter(elem => arr1.indexOf(elem) === -1);
    return [...arr1, ...arr2];
}
function union(arr1, arr2) {
    return arr1.concat(arr2.filter(elem => arr1.indexOf(elem) === -1))
}
function union(arr1, arr2) {
    return [...new Set([...arr1, ...arr2])]
}
function union(arr1, arr2) {
    return [...new Set(arr1.concat(arr2))]
}
function union(...arr) {
    return arr.reduce((first, second) => [...new Set(first.concat(second))]);
}