Return the missing letters

Tell us what’s happening:

I think my code is correct but it doesn’t work.
Could someone tell me why this is not working?

Your code so far


function fearNotLetter(str) {
let alphabet = "abcdefghijklmnopqrstuvwxyz"
let indexStr = alphabet.indexOf(str[0]);
let result;
for (let i= indexStr; i< str.length; i++ ) {
  if (str[i] != alphabet[indexStr+ i]) {
    result = alphabet[indexStr+ i]
  };
};
return result;
};

fearNotLetter("abce"); // must return "d"
console.log(fearNotLetter("abcdefghjklmno")); // must return "i"

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:79.0) Gecko/20100101 Firefox/79.0.

Challenge: Missing letters

Link to the challenge:

okay, I got it to work (I only did this a few days ago myself, so I figured working out on it would be good practice.

Your code is basically good and the way I did it when I passed it, but there are a few hiccups there. I’m going to be a little vague so you can figure it out yourself.

One, you can return the missing letter immediately and you don’t have to wait until the end. Although the way you do it does work for “undefined,” it also wastes loop cycles… I guess that’s a judgment call.

But the root of the issue is in your for loop. If you step through it, I think you’ll see that it’s not accomplishing what you want. When I made it completely basic, I passed all the tests.

I have found my fault thx