const makeRepeated = (arr, repeats) => Array.from({ length: repeats }, () => arr).flat(); console.log(makeRepeated([1, 2, 3], 2));
[1, 1, 2, 2, 3].filter((element, index, array) => array.indexOf(element) !== index) // [1, 2]