Challenge Missing letters - Why is this code not working?

I can’t get why this code is wrong. I must be something obvious, I still can’t see it. Please give me hints so that I can solve this challenge :slight_smile:

function fearNotLetter(str) {
  
  for (var i = 1; i < str.length; i++) {
    if (str.charCodeAt(i) == str.charCodeAt(i-1)+1) {
      continue;
    } else {
      return str.fromCharCode(str.charCodeAt(i));
    }
  }
  return undefined;
}

In your else statement, you should call fromCharCode differently :

String.fromCharCode(str.charCodeAt(i));

See the following information page : http://devdocs.io/javascript/global_objects/string/fromcharcode

1 Like

Thanks @Mizu. I corrected it into this:
return String.fromCharCode(str.charCodeAt(i));

However, I am still getting two red ticks. What else could be wrong? :slight_smile:

Have you noticed that your return statement actually doesn’t return the missing letter ? What needs to be done ?

Thanks again! I totally forgot it. I should add minus 1. :slight_smile:
It works now :smiley:

1 Like

Happy to help :slight_smile: Good coding!

1 Like

Thanks, to you too! All the best!