First test working
This commit is contained in:
parent
61cd0cb83f
commit
056e386b16
|
@ -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
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue