Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

9
  • 1
    possible duplicate: stackoverflow.com/questions/1960473/unique-values-in-an-array Commented May 13, 2016 at 22:35
  • 1
    @42shadow42: This is not about unique, though; see the examples Commented May 13, 2016 at 22:35
  • Oh my mistake, you want all copies of the duplicate removed not all but one thanks for correcting me. Commented May 13, 2016 at 22:36
  • 2
    Please show us your attempts nonetheless. Commented May 13, 2016 at 22:39
  • 3
    myArr.filter((x, i, a) => a.indexOf(x) === a.lastIndexOf(x)) should do it Commented May 13, 2016 at 22:40