Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const unique = (array) => {
- const unique = {}
- const result = []
- array.forEach((key) => {
- if (unique.hasOwnProperty(key)) {
- return
- }
- result.push(key)
- unique[key] = 1
- })
- return result
- }
- // --------------------
- const unique = array => [...new Set(array)];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement