Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

duplicates array js

let arr = [1, 2, 3, 4, 3, 3, 3]

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

let arr = [1, 2, 3, 4, 3, 3, 3, 'foo', true]

console.log([...new Set(arr)])
//(6) [1, 2, 3, 4, 'foo', true]
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #duplicates #array #js
ADD COMMENT
Topic
Name
7+1 =