Postscript
Removing duplicate items from your array EG convert [1,2,2,1,4,8,8,9] to [1,2,4,8,9]
Create a new set from your original array and then spread the set into a new array.
const animals = ["cat","dog","monkey","cat"] const nums = [1,7,2,4,1,1,2,7,2,4]; const uniqueAnimals = [...new Set(animals)]; // ["cat","dog","monkey"] const uniqueNums = [...new Set(nums)]; // [1,7,2,4]
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Postscript
Removing duplicate items from your array
EG convert [1,2,2,1,4,8,8,9] to [1,2,4,8,9]
Create a new set from your original array and then spread the set into a new array.