Tell us what’s happening:
Hi everyone,
I believe that I’ve already solved this algorithm challenge. It asks me to return undefined if there is no letter missing, however, when I continue to do so, it returns “Can’t convert undefined to object”. I hope I’m not the one missing anything but I’d appreciate any assitance.
Thanks
Your code so far
function fearNotLetter(str) {
for( let i = 0; i < str.length; i++ ){
if(i + 1 !== str.length + 1){
if( String.charCodeAt(str[i + 1]) - String.charCodeAt(str[i]) !== 1 ){
return String.fromCharCode( String.charCodeAt(str[i + 1]) - 1 );
}
}
}
return undefined;
}
fearNotLetter("abce");
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:60.0) Gecko/20100101 Firefox/60.0
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/missing-letters