0

i have an array, const colors = ['red,'blue','green','yellow','red','blue'];

How should i remove all the duplicate colors in this array ?

I tried various methods , but those were very lengthy. i am expecting a straightforward solution for this problem.

kinngCoder
  • 11
  • 2
  • This is already answered [here..](https://stackoverflow.com/questions/9229645/remove-duplicate-values-from-js-array) – Spy1984 Dec 22 '22 at 09:19
  • let myArray= ['red,'blue','green','yellow','red','blue']; let unique = [...new Set(myArray)]; console.log(unique); – Pramod Dec 22 '22 at 09:22

0 Answers0