Last active
May 30, 2022 18:35
-
-
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?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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