Dry Principle on Intermediate Algorithm Scripting: Missing letters topic

Tell us what’s happening:
Hello everyone,
As far as I am going through the curriculum, writing codes with the DRY principle is a Lil bit hard, and sometimes finding optimal solutions is harder than my expectations, so I am looking for a methodology for breaking down any programming issue. check out my code down below and compare it with GET HINT solutions.
Thank you all

Your code so far
function fearNotLetter(str) {
let allEnglishLetters=“abcdefghijklmnopqrstuvwxyz”.split("");
let characterAtFirstIndex=str.charAt(0);
let characterAtLastIndex=str.charAt(str.length-1);
let indexOfTheFirstCharacter;
let indexOfTheLastCharacter;
let newEnglishLetters=;
for(let index in allEnglishLetters){
if (allEnglishLetters[index]===characterAtFirstIndex){
indexOfTheFirstCharacter=parseInt(index);
}
if (allEnglishLetters[index]===characterAtLastIndex){
indexOfTheLastCharacter=parseInt(index)+1;
}
}
newEnglishLetters=allEnglishLetters.slice(indexOfTheFirstCharacter,indexOfTheLastCharacter);

str=newEnglishLetters.filter((value)=>
{ if (!str.includes(value)){
return value;
}});
return str.length==0?undefined:str.toString();
}


function fearNotLetter(str) {
let allEnglishLetters="abcdefghijklmnopqrstuvwxyz".split("");
let characterAtFirstIndex=str.charAt(0);
let characterAtLastIndex=str.charAt(str.length-1);
let indexOfTheFirstCharacter;
let indexOfTheLastCharacter;
let newEnglishLetters=[];
for(let index in allEnglishLetters){
if (allEnglishLetters[index]===characterAtFirstIndex){
  indexOfTheFirstCharacter=parseInt(index);
}
if (allEnglishLetters[index]===characterAtLastIndex){
  indexOfTheLastCharacter=parseInt(index)+1;
}
}
newEnglishLetters=allEnglishLetters.slice(indexOfTheFirstCharacter,indexOfTheLastCharacter);


str=newEnglishLetters.filter((value)=>
{ if (!str.includes(value)){
    return value;
}});
return str.length==0?undefined:str.toString();
}

console.log(fearNotLetter("abcde"));

Your browser information:

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

Challenge: Missing letters

Link to the challenge:

The main thing, as I think you can see, is the hint solutions don’t use nearly as many intermediate variables as you do. They focus on using the index of the character. In ASCII those indexes are going to be sequential for this set (lowercase a-z) of test variables; if you added uppercase it’d get more complicated. Hence rather than bounce string-index-string via variables they’re doing it more directly.

And, because they’re using the index from ASCII, they don’t have to input the whole alphabet, split it, then give those variables indexes. Because ASCII already did. And my favorite is solution 3, just checks if the index values are adjacent, and if not, returns what should have been there. Really clean.