How create the one level array with all arguments?

function uniteUnique(arr) {

// const years = [2016 , 2017 , 2018 , 2016 , 2019 , 2017]; 
// const distinctYears = [...new Set(years) ]; 
// console.log(distinctYears);

console.log(arr);
arr = arr.flat(4);

let arr1 = [...new Set(arr)];
console.log(arr1);

return arr1;
}

uniteUnique([1, 3, 2], [5, 2, 1, 4], [2, 1]);

link: https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/sorted-union

uniteUnique(…arr) solved