Weird assertion problem in "JavaScript Practice: Classes"

Dear community,

I have stumbled into a weird issue when clicking “check answer” on “JavaScript Practice: Classes”, (JavaScript Syntax, Part III) (the third challenge) - Link: https://www.codecademy.com/paths/front-end-engineer-career-path/tracks/fecp-javascript-syntax-part-iii/modules/fecp-practice-javascript-syntax-classes/articles/fecp-javascript-practice-classes

When I click “Check answer”, I get the message

“Tested method encrypt('Z') with a shift of 1 , expected 'A' . In the encrypt() method, did you handle wrapping around to the beggining of the alphabet?”

However, when I run my code with "encrypt(‘Z’), I get ‘A’ returned. Therefore, the assertion code should not react on this.

My code to reproduce:

// Write class below
class ShiftCipher {
  constructor(shift) {
    this.shift = shift
  }

  charIsLetter(char) {
    return (/[a-zA-Z]/).test(char);
  }

  encrypt(string) {
    let encryptedString = ""
    for (let i = 0; i <= string.length; i++) {
      if (this.charIsLetter(string[i])) {
        let UTFencryptedIndex = string.charCodeAt(i) + this.shift;
      
        if ((UTFencryptedIndex > 90 && UTFencryptedIndex < 97) || UTFencryptedIndex > 122) {
          UTFencryptedIndex -= 26
        }
        encryptedString += String.fromCharCode(UTFencryptedIndex)
      } else {
        encryptedString += string[i]
      }
    }
    return encryptedString.toUpperCase();;
  }

  decrypt(string) {
    let decryptedString = ""

    for (let i = 0; i <= string.length; i++) {
      if (this.charIsLetter(string[i])) {
        let UTFencryptedIndex = string.charCodeAt(i) - this.shift;

        if (UTFencryptedIndex < 65) {
          UTFencryptedIndex += 26;
        }

        decryptedString += String.fromCharCode(UTFencryptedIndex)
      } else {
        decryptedString += string[i]
      }
    }
    return decryptedString.toLowerCase();
  }
}

const cipher = new ShiftCipher(1);

console.log(cipher.encrypt('Z'));

// console.log(cipher.decrypt('K <3 OA RWRRA'));

Any ideas?

(Also, just noticed there is a typo in the assertion message, “beggining”, if a mod sees this)