Missing letters (&& condition not working)

Tell us what’s happening:

First help post, sorry if it isn’t formatted correctly.

I am not sure why I can’t return undefined with this && condition? I found some of the other solutions on the forums but want to understand why this, in particular, doesn’t work.

Otherwise the missing checker is working correctly.

Thanks for the advice!

Your code so far

function fearNotLetter(str) {

  let charCodeArr = [];

  for (let i = 0; i < str.length; i++) {

  for(var i = 1; i < charCodeArr.length; i++) {

    if (charCodeArr[i] - charCodeArr[i-1] != 1) {
      let missingNum = charCodeArr[i] - 1;
      return String.fromCharCode(missingNum)
    else if (charCodeArr[i] - charCodeArr[i-1] == 1 && charCodeArr[i] - charCodeArr[i-1] != 2) {
      return undefined;

  return str;


Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36.

Link to the challenge:

What do you mean?

You are returning undefined with && condition.


The issue seems to be that I can’t have both conditions work. If the && statement works the other statement doesn’t.

Not understanding your question concerning the line above. Can you explain what you are trying to do in this else if statement? Just to be clear, both of the conditions in the else if statement must be true for undefined to be returned. Why? Because && means AND.

I am using it so that it doesn’t trigger before the loop finds the missing character.

I am essentially trying to make a condition that doesn’t automatically occur before it should with the full alphabet case.

I can tell it won’t work but can’t quite figure out the alternative besides copying someone else’s answer.

What I am trying to get you to explain is what do you think these conditions are actually checking?

1 Like

I figured it out.

Just my misunderstanding of the scope of returns.

1 Like

I do realize how I was incorrectly using the && statement.

Thanks for the help!