From bd9aeecd221d2862cbaad8516f6a26b44f8e18ee Mon Sep 17 00:00:00 2001 From: billalp <billal.patel@rightmove.co.uk> Date: Mon, 28 Oct 2019 11:50:07 +0000 Subject: [PATCH] Tests work without capitalisation check --- caesar/caesar.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/caesar/caesar.js b/caesar/caesar.js index 58fedf4..6e8674d 100644 --- a/caesar/caesar.js +++ b/caesar/caesar.js @@ -8,16 +8,17 @@ const caesar = function(value, addBy) { var newArr = []; for (var i = 0; i < valueArray.length; i++) { + if (alphabet.includes(valueArray[i])) { let letterIndex = alphabet.indexOf(valueArray[i]); - let finalIndex = letterIndex + addBy; + let finalIndex = letterIndex + addBy; newArr.push(alphabet[finalIndex]); } else if (specialChars.includes(valueArray[i])) { newArr.push(valueArray[i]); } else { // return 'is not a part of the alphabet'; - return 'no'; + return 'Hello' } } return newArr.join(''); @@ -27,8 +28,8 @@ module.exports = caesar; /* Pseudocode 1 Take input and place in an array - then we have an array of letters -2 If not a letter then ignore -3 If a space or ! then return space or ! +2 If not a letter then ignore - DONE +3 If a space or ! then return space or ! - DONE 4 If it is a letter, it comes to the end then keep going around 5 6