Determining a pangram string in JavaScript

JavascriptWeb DevelopmentFront End Technology

Pangram strings:

A pangram is a string that contains every letter of the English alphabet.

We are required to write a JavaScript function that takes in a string as the first and the only argument and determines whether that string is a pangram or not. For the purpose of this problem, we will take only lowercase alphabets into consideration.


The code for this will be −

 Live Demo

const str = 'We promptly judged antique ivory buckles for the next prize';
const isPangram = (str = '') => {
   str = str.toLowerCase();
   const { length } = str;
   const alphabets = 'abcdefghijklmnopqrstuvwxyz';
   const alphaArr = alphabets.split('');
   for(let i = 0; i < length; i++){
      const el = str[i];
      const index = alphaArr.indexOf(el);
      if(index !== -1){
         alphaArr.splice(index, 1);
   return !alphaArr.length;


And the output in the console will be −

Published on 24-Feb-2021 05:58:40