For example, a shift cipher with a shift of 1 would turn the string 'hello' to 'ifmmp'.
Create a class ShiftCipher that takes the numerical value of the shift as a constructor parameter. The class should have to methods:
encrypt: takes a plain text string and returns a capitalized string with each letter shifted forward in the alphabet based on the set shift value.
decrypt: takes and encrypted message and returns a lower case string with each letter shifted back in the alphabet based on the set shift value.
In both methods, any character outside the alphabet should remain the same.
But if a character is shifted outside the alphabet in either direction it should be wrapped around to the other side. For example, encripting a y with a shift of 4 results in C and decrypting an A with a shift of 1 result in z.
Example:
const cipher = new ShiftCipher(2);
cipher.encrypt('I love to code!'); // returns 'K NQXG VQ EQFG!'
cipher.decrypt('K <3 OA RWRRA'); // returns 'i <3 my puppy'
Feel free to reference the Unicode Table as well as the JavaScript String methods including: toUpperCase(), toLowerCase(), charCodeAt() and fromCharCode()
For example, a shift cipher with a shift of 1 would turn the string 'hello' to 'ifmmp'. Create a class ShiftCipher that takes the numerical value of the shift as a constructor parameter. The class should have to methods:
Feel free to reference the Unicode Table as well as the JavaScript String methods including: toUpperCase(), toLowerCase(), charCodeAt() and fromCharCode()