Answers for "unique set in javascript"

3

js unique using set

let uniqueArray = [...new Set([5,5,2,2,2,4,2])];
// [5,2,4]
Posted by: Guest on May-05-2020
33

set js

// Use to remove duplicate elements from the array 

const numbers = [2,3,4,4,2,3,3,4,4,5,5,6,6,7,5,32,3,4,5]

//spreading numbers of the object into an array using the new operator
console.log([...new Set(numbers)]) 

// [2, 3, 4, 5, 6, 7, 32]
Posted by: Guest on January-22-2020

Code answers related to "unique set in javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language