Last active
May 31, 2022 17:18
-
-
Save transparenceweb/befaf91dc24e995bb90ca6b79cb703aa to your computer and use it in GitHub Desktop.
Cassidoo code question #250
This file contains hidden or 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
| function allUnique(string) { | |
| if (string.length !== (new Set(string)).size) { | |
| console.log(`Duplicate characters, same case, in '${string}'`); | |
| return false; | |
| } else { | |
| if (string.length !== (new Set(string.toLowerCase()).size)) { | |
| console.log(`Duplicate characters across cases in '${string}'`); | |
| return false; | |
| } else { | |
| console.log(`No duplication in '${string}'`); | |
| return true; | |
| } | |
| } | |
| } | |
| console.log(allUnique("Blue")); | |
| console.log(allUnique("Yellow")); | |
| console.log(allUnique("Purple")); |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Problem
Approach