Skip to content

Instantly share code, notes, and snippets.

@lumie31
Last active May 30, 2022 18:35
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 lumie31/81fcda7162cbfe03c917e88678700a23 to your computer and use it in GitHub Desktop.
Save lumie31/81fcda7162cbfe03c917e88678700a23 to your computer and use it in GitHub Desktop.
Write a function that determines if all the characters in a given string are unique?
// Method 1
const allUnique = (str) => new Set(str.toLowerCase()).size !== str.toLowerCase().length ? false : true
// Method 2
const allUnique = (str) => !(str.toLowerCase().length !== new Set(str.toLowerCase()).size);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment