Remove duplicates from [1,2,2,3,3,3,4] preserving order.
Ready — edit the code above and click Run.
const arr = [1, 2, 2, 3, 3, 3, 4];
console.log([...new Set(arr)]);
Try solving on your own first, then reveal the official answer.
Set keeps unique values; spread back to array. Interview follow-up: implement without Set.