Update caesar.js

lol i'm dum
This commit is contained in:
Cody Loyd 2020-11-16 12:25:23 -06:00 committed by GitHub
parent bde09dacbd
commit e5a4a1d2eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -7,9 +7,9 @@ const caesar = function(string, shift) {
const codeSet = code => (code < 97 ? 65 : 97); const codeSet = code => (code < 97 ? 65 : 97);
# this function is just a fancy way of doing % so that it works with negative numbers // this function is just a fancy way of doing % so that it works with negative numbers
# see this link for details: // see this link for details:
# https://stackoverflow.com/questions/4467539/javascript-modulo-gives-a-negative-result-for-negative-numbers // https://stackoverflow.com/questions/4467539/javascript-modulo-gives-a-negative-result-for-negative-numbers
const mod = (n, m) => (n % m + m) % m; const mod = (n, m) => (n % m + m) % m;
const shiftChar = (char, shift) => { const shiftChar = (char, shift) => {