From 192b81fc655016d218d2dc6f65495bce2df0c753 Mon Sep 17 00:00:00 2001 From: Angela Yu <8798027+angelabauer@users.noreply.github.com> Date: Tue, 23 Jul 2024 10:08:57 +0100 Subject: [PATCH] Update index.js --- index.js | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 9150c83..ba55802 100644 --- a/index.js +++ b/index.js @@ -79,6 +79,32 @@ const alphabet = [ "x", "y", "z", + "a", + "b", + "c", + "d", + "e", + "f", + "g", + "h", + "i", + "j", + "k", + "l", + "m", + "n", + "o", + "p", + "q", + "r", + "s", + "t", + "u", + "v", + "w", + "x", + "y", + "z", ]; //Click Run @@ -174,7 +200,7 @@ function NewLine(text, isPrompt) { function caesar(cipher_direction, start_text, shift_amount) { let end_text = ""; if (cipher_direction == "decode") { - shift_amount *= -1; + shift_amount = shift_amount * -1 + 26; } for (char in start_text) { if (alphabet.includes(start_text[char])) {