Skip to content

Instantly share code, notes, and snippets.

@MahmoudAgamy
Created February 13, 2019 15:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MahmoudAgamy/ba2ac6ea01ebf30db806c6e8f6599a35 to your computer and use it in GitHub Desktop.
Save MahmoudAgamy/ba2ac6ea01ebf30db806c6e8f6599a35 to your computer and use it in GitHub Desktop.
let strArr = [ 'a', 'a', 'b', 'b', 'b', 'c', 'b', 'c', 'k' ]
let uniqueVal = strArr.filter((elem, i) => strArr.indexOf(elem) == i);
console.log(uniqueVal) // [ 'a', 'b', 'c', 'k' ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment