Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 27ae62e commit 489544dCopy full SHA for 489544d
1 file changed
Ciphers/Atbash.js
@@ -11,11 +11,13 @@ const Atbash = (str) => {
11
}
12
13
return str.replace(/[a-z]/gi, (char) => {
14
+ const charCode = char.charCodeAt()
15
+
16
if (/[A-Z]/.test(char)) {
- return String.fromCharCode(90 + 65 - char.charCodeAt())
17
+ return String.fromCharCode(90 + 65 - charCode)
18
19
- return String.fromCharCode(122 + 97 - char.charCodeAt())
20
+ return String.fromCharCode(122 + 97 - charCode)
21
})
22
23
0 commit comments