Ruphaa's Notes

How to remove duplicates from an array in JS

js

Method 1: Using Set

let nums = [0, 0, 1, 1, 1, 2, 2, 3, 3, 4];

let uniqueNum = Array.from(new Set([...nums]));