Exercism v3 launches on Sept 1st 2021. Learn more! 🚀🚀🚀
Avatar of thekeele

thekeele's solution

to Pangram in the JavaScript Track

Published at Aug 17 2019 · 0 comments
Test suite


This exercise has changed since this solution was written.

Determine if a sentence is a pangram. A pangram (Greek: παν γράμμα, pan gramma, "every letter") is a sentence using every letter of the alphabet at least once. The best known English pangram is:

The quick brown fox jumps over the lazy dog.

The alphabet used consists of ASCII letters a to z, inclusive, and is case insensitive. Input will not contain non-ASCII symbols.


Go through the setup instructions for Javascript to install the necessary dependencies:



Install assignment dependencies:

$ npm install

Making the test suite pass

Execute the tests with:

$ npm test

In the test suites all tests but the first have been skipped.

Once you get a test passing, you can enable the next one by changing xtest to test.


Wikipedia https://en.wikipedia.org/wiki/Pangram

Submitting Incomplete Solutions

It's possible to submit an incomplete solution so you can see how others have completed the exercise.


import { isPangram } from './pangram';

describe('Pangram()', () => {
  test('empty sentence', () => {

  xtest('recognizes a perfect lower case pangram', () => {

  xtest('pangram with only lower case', () => {
    expect(isPangram('the quick brown fox jumps over the lazy dog')).toBe(true);

  xtest("missing character 'x'", () => {
    expect(isPangram('a quick movement of the enemy will jeopardize five gunboats')).toBe(false);

  xtest("another missing character, e.g. 'h'", () => {
    expect(isPangram('five boxing wizards jump quickly at it')).toBe(false);

  xtest('pangram with underscores', () => {

  xtest('pangram with numbers', () => {
    expect(isPangram('the 1 quick brown fox jumps over the 2 lazy dogs')).toBe(true);

  xtest('missing letters replaced by numbers', () => {
    expect(isPangram('7h3 qu1ck brown fox jumps ov3r 7h3 lazy dog')).toBe(false);

  xtest('pangram with mixed case and punctuation', () => {
    expect(isPangram('"Five quacking Zephyrs jolt my wax bed."')).toBe(true);

  xtest('upper and lower case versions of the same character should not be counted separately', () => {
    expect(isPangram('the quick brown fox jumps over with lazy FX')).toBe(false);
// This is only a SKELETON file for the 'Pangram' exercise. It's been provided as a
// convenience to get you started writing code faster.

export const isPangram = (sentence) => {
  let alphabet = 'abcdefghijklmnopqrstuvwxyz'.split('');
  let pangram = [];

  for (let char of sentence) {
    char = char.toLowerCase();
    if (alphabet.includes(char) && !pangram.includes(char)) {

  return pangram.sort().toString() == alphabet.toString();

Community comments

Find this solution interesting? Ask the author a question to learn more.

What can you learn from this solution?

A huge amount can be learned from reading other people’s code. This is why we wanted to give exercism users the option of making their solutions public.

Here are some questions to help you reflect on this solution and learn the most from it.

  • What compromises have been made?
  • Are there new concepts here that you could read more about to improve your understanding?