Missing letters - javascript challenge suggestion

I believe I came up with a solution that is worth evaluating to be on the hints page, but I didn’t know how to suggest it. Here it is:


function fearNotLetter(str) {
  var alphabet = "abcdefghijklmnopqrstuvwxyz".split("")
  for(var i=0; i<str.length-1; i++){
    if(str[i+1] != alphabet[alphabet.indexOf(str[i])+1])
      return alphabet[alphabet.indexOf(str[i])+1]
  }
}

console.log(fearNotLetter("abce")); //prints "d"

For each character in str up to the second last, it compares the next one (str[i+1]) with the character that comes after it in the alphabet array (alphabet[alphabet.indexOf(str[i])+1]). It should be the same unless there is a character missing. If that is the case, return said character.

I hope I have been of some help

Browser information:

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

Link to the challenge:
https:/ /learn.freecodecamp.org/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/missing-letters

The guide is open source. Any member of the community can submit a Pull Request for review.