Skip to content

Instantly share code, notes, and snippets.

@james-fourth
Last active February 12, 2020 00:52
Show Gist options
  • Save james-fourth/ef4f1300d652a53b91864406bdbe7321 to your computer and use it in GitHub Desktop.
Save james-fourth/ef4f1300d652a53b91864406bdbe7321 to your computer and use it in GitHub Desktop.
Remove duplicates from a string
const dedupe = (string) => {
const parsed = string.split('')
let deduplicate = [];
parsed.map(function(value) {
if (!deduplicate.includes(value)) {
deduplicate.push(value);
}
})
return deduplicate.join('');
}
export default dedupe;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment