const arr = [1, 2, 2, 3, 3, 4]; const newArr = [...new Set(arr)]; console.log(newArr); // [1, 2, 3, 4]