First test working

This commit is contained in:
billalp 2019-10-28 09:24:12 +00:00
parent 61cd0cb83f
commit 056e386b16
1 changed files with 21 additions and 2 deletions

View File

@ -1,5 +1,24 @@
const caesar = function() { const caesar = function(value, addBy) {
const alphabet = 'abcdefghijklmnopqrstuvwxyz'.split('');
const newVal = value.toString().toLowerCase();
if (alphabet.includes(newVal) === true) {
var letterIndex = alphabet.indexOf(newVal);
var finalIndex = letterIndex + addBy;
return alphabet[finalIndex].toUpperCase();
} else {
return 'Value is not a part of the alphabet';
}
} }
module.exports = caesar module.exports = caesar;
/* Pseudocode
*/