using set to solve uniqueness javascript code example Example: js unique using set let uniqueArray = [...new Set([5,5,2,2,2,4,2])]; // [5,2,4]