Skip to content

Commit 21a49a4

Browse files
committed
feat: used regex instead of Set
1 parent d466be9 commit 21a49a4

1 file changed

Lines changed: 1 addition & 9 deletions

File tree

String/CheckPangram.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,7 @@ const checkPangram = (string) => {
88
throw new TypeError('The given value is not a string')
99
}
1010

11-
const frequency = new Set()
12-
13-
for (const letter of string.toLowerCase()) {
14-
if (letter >= 'a' && letter <= 'z') {
15-
frequency.add(letter)
16-
}
17-
}
18-
19-
return frequency.size === 26
11+
return string.match(/([a-z])(?!.*\1)/gi).length === 26
2012
}
2113

2214
export { checkPangram }

0 commit comments

Comments
 (0)