Build a Missing Letter Detector

Tell us what’s happening:

I am passing every test except 4 and 5. I understand that the “changer” variable is parsed through with my for loop, but I don’t understand how to create a string that is iterable from the start of the string to the string’s end. When I output the given code, I receive, “d” for fearNotLetter(“abce”) and, “a” for fearNotLetter(“stvwx”); I don’t understand why the call does not loop from the start of “stvwx”.

Your code so far

function fearNotLetter(string) {
  const alphabet = "abcdefghijklmnopqrstuvwxyz";
  let missing = "";
  let changer = string.slice(0);
  console.log(changer);
  for (let letter of alphabet) {
    if (!changer.includes(letter)){
     missing += letter;
    return missing;
    }}
}

console.log(fearNotLetter("abce"));
console.log(fearNotLetter("stvwx"));
console.log(fearNotLetter("abcdefghijklmnopqrstuvwxyz"));

Your browser information:

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

Challenge Information:

Build a Missing Letter Detector - Build a Missing Letter Detector

GitHub Link: freeCodeCamp/curriculum/challenges/english/blocks/lab-missing-letter-detector/af7588ade1100bde429baf20.md at main · freeCodeCamp/freeCodeCamp · GitHub

add console.log(letter) as first line inside the loop, see what letters it is checking

you also want to consider if stvwx is your string, do you want a to be considered the missing letter?

you can’t always start the alphabet from a if the string does not start there