Tell us what’s happening:
I am stuck here. I think I have done everything I can;;
Your code so far
function fearNotLetter(str){
const alphabet = 'abcdefghijklmnopqrstuvwxyz';
const alphaArr = alphabet.split('');
let strArr = str.split('');
console.log(strArr);
const firstLetter = strArr[0];
const lastLetter = strArr[str.length - 1];
const alphaFirstIndex = alphaArr.indexOf(firstLetter);
for (let i = 0; i < str.length; i++){
if (strArr[i] == alphaArr[alphaFirstIndex + i]){
console.log('yes');
}else {
console.log(strArr[i]);
console.log('no');;
}
}
}
fearNotLetter('abce');
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36
Challenge Information:
Build a Missing Letter Detector - Build a Missing Letter Detector
ILM
November 27, 2025, 2:21pm
2
what issue do you need help with?
i have done it upto here. I can’t understand how I am supposed to return the character which is missing..
And how are you stuck?
Note that console logging doesn’t returning anything
I can make the code tell me there is a missing letter, but I don’t understand how to specify which letter should the code should return.
ILM
November 28, 2025, 4:17pm
6
how does it know that this one is the missing letter? if it knows it’s the missing letter, then it should also know which is the missing letter
it doesnot. i am asking how to make it understand which letter is missing
ILM
November 28, 2025, 4:24pm
8
what is strArr[i] == alphaArr[alphaFirstIndex + i] checking then? and what are these two values?
strArr[i] is looping through the strArr and finding the characters, whereas alphaArr[alphaFirstIndex + i] looking if the value after the first letter provided by array is correct. These two will keep on checking, but when it reaches the missing letter then, the code gets messed up.
(abce)
this will run but when it reaches “d”, it gets messed up and logs both d and e . So , i don’t know what to do after that
ILM
November 28, 2025, 4:30pm
10
where do you see it’s logging both d and e?
if it’s logging the d, return it
it’s not logging ‘d’ I don’t know how to do that;
it’s logging e though, but there’s no point in that
ILM
November 28, 2025, 4:35pm
13
what happens when they are not equal, like at one point strArr[i] is c, and alphaArr[alphaFirstIndex + i] is also c, what happens after that?
what values do they have after this?
console.log(alphaArr[alphaFirstIndex + i]);
I did this. It’s logging ‘d’.
it worked
function fearNotLetter(str){
const alphabet = 'abcdefghijklmnopqrstuvwxyz';
const alphaArr = alphabet.split('');
let strArr = str.split('');
console.log(strArr);
const firstLetter = strArr[0];
const lastLetter = strArr[str.length - 1];
const alphaFirstIndex = alphaArr.indexOf(firstLetter);
for (let i = 0; i < str.length; i++){
if (strArr[i] == alphaArr[alphaFirstIndex + i]){
continue
}else {
console.log(alphaArr[alphaFirstIndex + i]);
return alphaArr[alphaFirstIndex + i];
}
}
return undefined
}
fearNotLetter('abce');