Advertisement
Guest User

Untitled

a guest
Jul 17th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  1. const unique = (array) => {
  2. const unique = {}
  3. const result = []
  4.  
  5. array.forEach((key) => {
  6. if (unique.hasOwnProperty(key)) {
  7. return
  8. }
  9. result.push(key)
  10. unique[key] = 1
  11. })
  12.  
  13. return result
  14. }
  15.  
  16. // --------------------
  17. const unique = array => [...new Set(array)];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement