From b4909d27a3cdcafbe54ff496e7553aa51c522fbf Mon Sep 17 00:00:00 2001 From: c-auri <43008483+c-auri@users.noreply.github.com> Date: Fri, 18 Nov 2022 16:16:41 +0100 Subject: [PATCH] Extract const variable for readability --- caesar/caesar.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/caesar/caesar.js b/caesar/caesar.js index a4d935a..9401590 100644 --- a/caesar/caesar.js +++ b/caesar/caesar.js @@ -17,9 +17,8 @@ const shift = (char, shiftValue) => { const code = char.charCodeAt(); if ((code >= 65 && code <= 90) || (code >= 97 && code <= 122)) { - return String.fromCharCode( - mod(code + shiftValue - codeSet(code), 26) + codeSet(code) - ); + const shiftedCode = mod(code + shiftValue - codeSet(code), 26) + codeSet(code); + return String.fromCharCode(shiftedCode); } return char; };