[solved] Missing Letters Challenge Question (possible spoilers)

Why doesn’t this work? Everything works individually. I’m not seeing a reason why it won’t work as intended.

function fearNotLetter(str) {
var alph = [];
var alNum = [];
var mis = 0;
alph = str.split(’’);

for (var i = 0; i < alph.length; i++) {



for (var l = 0; l < alNum.length; l++) {
if (alNum[l] + 1 !== alNum[l+1] ) {
mis = alNum[l] + 1;
return String.fromCharCode(mis);

else {
return undefined;



My guess would be because of else

1 Like

The else is working fine. Passes the last two tests.

My guess would be that those last two test will pass even without else.

Turns out the else statement was preventing the if statement from working properly, probably because it was tacking on undefined at the end of each result, but the last two do not pass without else because they have to return undefined instead of [].

Solved it by adding a -1 to .length. I thought I’d need that to keep the last letter from being run but wasn’t sure until I wasn’t getting undefined .