Update caesar.js
This commit is contained in:
parent
8eeb98ee71
commit
bde09dacbd
|
@ -7,6 +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
|
||||||
|
# see this link for details:
|
||||||
|
# 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) => {
|
||||||
|
|
Loading…
Reference in New Issue