Hello I'm trying to solve the classic rotational cypher problem but im also trying to solve for when numbers are included in the string. So far this is the method I have been going about it using javascript:
function rotationalCipher(input, rotationFactor) {
const originalAlpha = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
return input.replace(/[a-z]/gi, letter => originalAlpha[originalAlpha.indexOf(letter)+rotationFactor]);
}
It works but it doesn't address the numbers within the string. Id be appreciative of any help.