every with includes

팬그램
팬그램 JavaScript에서
export function isPangram(input) {
  const inputLowered = input.toLowerCase();
  return [...'abcdefghijklmnopqrstuvwxyz'].every((c) =>
    inputLowered.includes(c),
  );
}
  • This begins by lowercasing the input by using the String toLowerCase method.
  • It uses spread syntax to make an Array out of a string of the alphabet.
  • It then checks if all letters in the alphabet are contained in the input, using the Array method every with the String method includes.

If all letters of the alphabet are in the input, then the function returns true.

2026년 10월 07일 · 유용했나요?