Missing letters - not passing the challenge

Tell us what’s happening:

Hi campers,
I have been working on this challenge on Repl.it and it does pass all tests both there and on my console. However, I am not passing the fearNotLetter(“abcdefghijklmnopqrstuvwxyz”) should return undefined test on FCC.

Could you take a look and let me know why my code is having problems?


Your code so far

let alphabet = 'abcdefghijklmnopqrstuvwxyz'.split('');

function fearNotLetter(str) {
  let foundLetter = "";
  let target = str.split('');
  let alphabetPortion = alphabet.slice(alphabet.indexOf(target[0]));

  for (let i = 0; i <= target.length; i++) {
    if (target.indexOf(alphabetPortion[i]) === -1) {
      foundLetter += alphabetPortion[i];

  if (foundLetter.length > 0) {
    return foundLetter;
  else {
  return undefined;


Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36.

Link to the challenge:

Add the following console.log statement on the line before the if (foundLetter.length > 0) { line and check your browser’s console (Ctrl+Shft+J in Chrome). I think you will be surprised what string value is displayed.

1 Like

your loop goes from 0 to (and including) the length of target.
So if alphabetPortion has 26 letters, and target has 26 letters, your loop goes from 0 to 26.

Does that sound like what you wanted to do?


Thank you so much for pointing me in the right direction, it worked!

1 Like