Pangram
This commit is contained in:
9
typescript/pangram/pangram.ts
Normal file
9
typescript/pangram/pangram.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
export const isPangram = (text: string): boolean =>
|
||||
text
|
||||
.toLowerCase()
|
||||
.split("")
|
||||
.sort()
|
||||
.map((v) => v.charCodeAt(0))
|
||||
.filter((v) => v >= 97 && v <= 97 + 25)
|
||||
.reduce((r, v) => (r[r.length - 1] === v ? r : [...r, v]), [] as number[])
|
||||
.length === 26;
|
||||
Reference in New Issue
Block a user