Skip to content

Latest commit

 

History

History
9 lines (7 loc) · 282 Bytes

File metadata and controls

9 lines (7 loc) · 282 Bytes
const removeDuplicate = arr => arr.filter(i => arr.indexOf(i) === arr.lastIndexOf(i));

// Example
removeDuplicate(['h', 'e', 'l', 'l', 'o', 'w', 'o', 'r', 'l', 'd']); //  ['h', 'e', 'w', 'r', 'd']

// or
const removeDuplicate = arr => Array.from(new Set(arr));