const fearNotLetter = (str) => {
let missing = undefined;
const alphabet = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'];
let letters = new Set(str.split(''));
let first = str[0];
let last = str[str.length - 1];
let firstLetterIndex = alphabet.indexOf(first);
let lastLetterIndex = alphabet.indexOf(last);
let newAlphabet = alphabet.splice(firstLetterIndex, lastLetterIndex + 1);
for (let letter of newAlphabet) {
if (!letters.has(letter)) return missing = letter;
}
}
fearNotLetter('abce');
1 Like
I don’t understand why you’d post the solution here. You want people to evaluate your approach?