Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

use set to remove duplicates in javascript

const names = ['John', 'Paul', 'George', 'Ringo', 'John'];

let unique = [...new Set(names)];
console.log(unique); // 'John', 'Paul', 'George', 'Ringo'
Source by wsvincent.com #
 
PREVIOUS NEXT
Tagged: #set #remove #duplicates #javascript
ADD COMMENT
Topic
Name
2+8 =