Skip to content

Commit 489544d

Browse files
committed
chore: added helper variable
1 parent 27ae62e commit 489544d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Ciphers/Atbash.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,13 @@ const Atbash = (str) => {
1111
}
1212

1313
return str.replace(/[a-z]/gi, (char) => {
14+
const charCode = char.charCodeAt()
15+
1416
if (/[A-Z]/.test(char)) {
15-
return String.fromCharCode(90 + 65 - char.charCodeAt())
17+
return String.fromCharCode(90 + 65 - charCode)
1618
}
1719

18-
return String.fromCharCode(122 + 97 - char.charCodeAt())
20+
return String.fromCharCode(122 + 97 - charCode)
1921
})
2022
}
2123

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy