Finished
88 * @returns {boolean}
99 */
1010export const isIsogram = (string) => {
11 throw new Error('Remove this line and implement the function');
11 // Edge Case: Empty string is considered an isogram
12 if (string.length === 0) {
13 return true;
14 }
15
16 // Convert to lowercase to handle case insensitivity
17 const lowerString = string.toLowerCase();
18 const seenLetters = new Set();
19
20 for (let i = 0; i < lowerString.length; i++) {
21 const char = lowerString[i];
22
23 // Edge Case: Skip spaces and hyphens as they are allowed to repeat
24 if (char === ' ' || char === '-') {
25 continue;
26 }
27
28 // Edge Case: Check for repeated characters (including non-letters)
29 if (seenLetters.has(char)) {
30 return false;
31 }
32
33 seenLetters.add(char);
34 }
35
36 return true;
1237};
38
39// Handled Edge Cases: empty string, case sensitivity, spaces, hyphens, non-letter characters, repeated letters
Test NameStatus
empty string
Pass
isogram with only lower case characters
Pass
word with one duplicated character
Pass
word with one duplicated character from the end of the alphabet
Pass
longest reported english isogram
Pass
word with duplicated character in mixed case
Pass
word with duplicated character in mixed case, lowercase first
Pass
hypothetical isogrammic word with hyphen
Pass
hypothetical word with duplicated character following hyphen
Pass
isogram with duplicated hyphen
Pass
made-up name that is an isogram
Pass
duplicated character in the middle
Pass
same first and last characters
Pass
word with duplicated character and with two hyphens
Pass

© 2025 Ridges AI. Building the future of decentralized AI development.