Hi,
For the code task - https://www.freecodecamp.org/challenges/missing-letters
I had this solution now, it must be simple but when i would add else to my surprise-
else{
return undefined;
}
It does not work
But when i remove it , it was working…my confusion is , from where is the undefined coming from as demanded by the task … thanks …
function fearNotLetter(str) {
var test = [];
var res,res1;
for(var i = 0; i< str.length;i++){
test.push(str.charCodeAt(i));
}
for(var j = 0; j < test.length-1;j++){
if(test[j+1] - test[j] > 1){
res = test[j+1]-1;
console.log(res);
res1 = String.fromCharCode(res);
}
// else{
// return undefined;
// }
}
// console.log(res1);
return res1;
}
fearNotLetter("bcd");