How to Find Unique Strings in an Array Using JavaScript

Finding the unique strings from a JavaScript array is a common task for web developers — here’s three ways of how to do it.

Image for post
Image for post
Photo by Gaelle Marcel on Unsplash

A Unique Array of Strings

Method 1 — Use Set to Find Unique Strings

Image for post
Image for post
View the raw code as a GitHub Gist

Method 2 —Unique Strings with a JavaScript Object

Image for post
Image for post
View the raw code as a GitHub Gist

Method 3 — Finding Unique Strings with ES5

Image for post
Image for post
View the raw code as a GitHub Gist

Conclusion: Set Removes Duplicate Strings

Unique Strings from Object Values

Join my email list to get free access to all of my Medium articles.

Coding in Simple English

Coding. Simply.

Sign up for Coding in Simple English

By Coding in Simple English

Monthly Updates from Coding in Simple English Take a look

By signing up, you will create a Medium account if you don’t already have one. Review our Privacy Policy for more information about our privacy practices.

Check your inbox
Medium sent you an email at to complete your subscription.

Dr. Derek Austin 🥳

Written by

🤓 The physical therapist who writes JavaScript 💪 Web Developer 😎 Mentor 🧠 DPT 😄 SEO Expert 😁 React 😆 Jamstack 💬 Ask me anything 👉 DoctorDerek.com 👈

Coding in Simple English

Coding. Simply.

Dr. Derek Austin 🥳

Written by

🤓 The physical therapist who writes JavaScript 💪 Web Developer 😎 Mentor 🧠 DPT 😄 SEO Expert 😁 React 😆 Jamstack 💬 Ask me anything 👉 DoctorDerek.com 👈

Coding in Simple English

Coding. Simply.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store