Freecodecamp: Incomplete tests in "Missing Letters"

Created on 12 Nov 2016  路  2Comments  路  Source: freeCodeCamp/freeCodeCamp


Challenge Name


https://www.freecodecamp.com/challenges/missing-letters

Issue Description


The tests are incomplete. There is no case for a sequence to test which does not start with the letter "a" but has a missing letter. You can therefore finish this challenge with an algorithm which, for example, matches the letters of the alphabet against the string.

Here is an example code that works while it does not conform to the task description:

var alphabet = "abcdefghijklmnopqrstuvwxyz";
function fearNotLetter(str) {
  var s = false;
  for (var i = alphabet.indexOf(str.charAt(0)); i < alphabet.length; i++) {
    if (!s && alphabet.charAt(i) === str.charAt(i)) {
      s = true;
    } else if (s && alphabet.charAt(i) !== str.charAt(i)) {
      return alphabet.charAt(i);
    }
  }
  return undefined;
}
help wanted

Most helpful comment

@Bouncey I'll take this up.

All 2 comments

Can we have a PR submitted to add a test to this challenge

The test should assert that

fearNotLetter('stvwx`) === 'u'

@Bouncey I'll take this up.

Was this page helpful?
0 / 5 - 0 ratings