export function isPangram(input) {
const inputLowered = input.toLowerCase();
return [...'abcdefghijklmnopqrstuvwxyz'].every((c) =>
inputLowered.includes(c),
);
}
- This begins by lowercasing the input by using the
StringtoLowerCasemethod. - It uses spread syntax to make an Array out of a
stringof the alphabet. - It then checks if all letters in the alphabet are contained in the input,
using the
Arraymethodeverywith theStringmethodincludes.
If all letters of the alphabet are in the input, then the function returns true.
4th Sep 2024
·
Found it useful?