Missing Letters test not passing. My code seems to be returning the correct values

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?


previousChar is not defined.

that’s the error I see when I log your function

1 Like

Thank you… So silly of me.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.