Missing Letters challenge possibly bugged?

Missing Letters challenge possibly bugged?
0.0 0

#1

Hi everyone, I think there’s a bug in the Missing Letter challenge ( Intermediate challenge ).
The first and Second solution seem to miss wrong, if I search more than one word in range, I only get the first letter missing.

and here’s the solutions I looked at. https://github.com/freeCodeCamp/freeCodeCamp/wiki/Algorithm-Missing-Letters
In fact, if I try to put ‘az’ the output is wrong,however I still manage to pass the challenge

Here’s my own code, also if you wish, you can tell me whether or not it’s decent enough. It checks every missing letter
On my own code I also used arrows, but I decided to put here a longer version for the sake of semplicity.


function fearNotLetter(str) {
  str = str.split("");
  var numbersInString = str.map(function(val) { // here we get the values of our starting point
    return val.charCodeAt();
  })
  var numbersToCompare = []
  for (x = numbersInString[0]; x < numbersInString[numbersInString.length -1] +1; x++) { // here we get and push all the values that go from starting to ending point
    numbersToCompare.push(x)
}
 var missingNumber = numbersToCompare.filter(function(val){ // here we get only the numbers(letters) we are missing
    return numbersInString.indexOf(val) === -1;
});
 var convertedMissingNumber = missingNumber.map(function(val){ // here we convert it to letters
    return String.fromCharCode(val)
  });
  if (numbersToCompare.length === numbersInString.length) { // here we check whether or we have all the letters in the range
    return undefined // <- if we do
  }
  
  return convertedMissingNumber.join("") // if we don't
  }

fearNotLetter("ax"));

I don’t know if the challenge is meant to only look for the first missing character, also sorry if this has already been posted and I’m totally wrong !
I also wanted to thank freeCodeCamp, because it’s what got me into programming!


#2

Hi there! I just finished that one recently. Based on the tests they gave and the way it was phrased: “find the missing letter” rather than “letters”, I interpreted it as only looking for a single letter, and my code written to do that passed the challenge.


#4

I had a solution very similar to this but I changed the stupid naming of the function and it didn’t know what to do, so it failed every time despite being correct. I fixed it though and now it’s working.