I’m having trouble passing the tests here. Perhaps there’s a serious bug in my program or maybe there are more fcc tests that I’m not aware of?
// Current code
function fearNotLetter(str) {
let currentChar;
let value;
for (let length = str.length - 1; length > 0; length-- )
{
currentChar = str.charCodeAt(length)
previousChar = str.charCodeAt(length - 1);
if (currentChar - previousChar > 1)
{
value = String.fromCharCode(currentChar - 1);
}
}
return value;
}
Each test locally returns the same values as type string which are displayed on the website. when all letters exist undefined is returned… I know my code can be tightened up and it’s not the best, but not sure here why my code isn’t passing any tests?
Thanks