Ad
Strings
Code
Diff
  • function isUnique(string) {
    const newString = new Set(string)
      return newString.size === string.length
    }
    
    • function isUnique(string) {
    • let knownChars = "";
    • for (let char of string) {
    • if (!knownChars.includes(char)) {
    • knownChars += char;
    • } else {
    • return false;
    • }
    • }
    • return true;
    • }
    • const newString = new Set(string)
    • return newString.size === string.length
    • }