diff --git a/challenges/01-front-end-development-certification/basic-javascript.json b/challenges/01-front-end-development-certification/basic-javascript.json
index 8c1ace5224..38afae6a6b 100644
--- a/challenges/01-front-end-development-certification/basic-javascript.json
+++ b/challenges/01-front-end-development-certification/basic-javascript.json
@@ -4436,29 +4436,61 @@
"title": "Caesar's Cipher",
"description": [
"One of the simplest and most widely known ciphers is a Caesar cipher
, also known as a shift cipher
. In a shift cipher
the meanings of the letters are shifted by some set amount. ",
- "A common modern use is a ROT13 cipher, where the values of the letters are shifted by 13 places. Thus A = N, B = O and so on.",
- "Write a function which takes a ROT13
encoded array of characters as input and returns a plain text encoded array. All letters will be uppercase. Do not transform any non-alphabetic character (IE: spaces, punctiation)."
+ "A common modern use is the ROT13 cipher, where the values of the letters are shifted by 13 places. Thus 'A' ↔ 'N', 'B' ↔ 'O' and so on.",
+ "Write a function which takes a ROT13
encoded string as input and returns a decoded string. All letters will be uppercase. Do not transform any non-alphabetic character (IE: spaces, punctiation), but do pass them on.",
+ "The provided code transforms the input into an array for you, codeArr
. Place the decoded values into the decodedArr
array where the provided code will transform it back into a string."
],
"releasedOn": "11/27/2015",
"tests": [
- "assert( rot13([ 'S', 'E', 'R', 'R', ' ', 'P', 'B', 'Q', 'R', ' ', 'P', 'N', 'Z', 'C' ]).join(\"\") === \"FREE CODE CAMP\", 'message: rot13([ 'S', 'E', 'R', 'R', ' ', 'P', 'B', 'Q', 'R', ' ', 'P', 'N', 'Z', 'C' ])
should decode to [ 'F', 'R', 'E', 'E', ' ', 'C', 'O', 'D', 'E', ' ', 'C', 'A', 'M', 'P' ]
');",
- "assert(1===1, 'message: blah');"
+ "assert(rot13(\"SERR PBQR PNZC\") === \"FREE CODE CAMP\", 'message: rot13(\"SERR PBQR PNZC\")
should decode to \"FREE CODE CAMP\"
');",
+ "assert(rot13(\"SERR CVMMN!\") === \"FREE PIZZA!\", 'message: rot13(\"SERR CVMMN!\")
should decode to \"FREE PIZZA!\"
');",
+ "assert(rot13(\"SERR YBIR?\") === \"FREE LOVE?\", 'message: rot13(\"SERR YBIR?\")
should decode to \"FREE LOVE?\"
');",
+ "assert(rot13(\"GUR DHVPX OEBJA QBT WHZCRQ BIRE GUR YNML SBK.\") === \"THE QUICK BROWN DOG JUMPED OVER THE LAZY FOX.\", 'message: rot13(\"GUR DHVPX OEBJA QBT WHZCRQ BIRE GUR YNML SBK.\")
should decode to \"THE QUICK BROWN DOG JUMPED OVER THE LAZY FOX.\"
');"
],
"challengeSeed": [
- "function rot13(codeArr) {",
- " // Your Code Here",
+ "function rot13(encodedStr) {",
+ " var codeArr = encodedStr.split(\"\"); // String to Array",
+ " var decodedArr = []; // Your Result goes here",
+ " // Only change code below this line",
"",
- " return []; // Change this Line",
+ "",
+ "",
+ " // Only change code above this line",
+ " return decodedArr.join(\"\"); // Array to String",
"}",
"",
"// Change the inputs below to test",
- "rot13([ 'S', 'E', 'R', 'R', ' ', 'P', 'B', 'Q', 'R', ' ', 'P', 'N', 'Z', 'C' ]);"
+ "rot13(\"SERR PBQR PNZC\");"
],
"tail": [
""
],
"solutions": [
- ""
+ "var lookup = {",
+ " 'A': 'N','B': 'O','C': 'P','D': 'Q',",
+ " 'E': 'R','F': 'S','G': 'T','H': 'U',",
+ " 'I': 'V','J': 'W','K': 'X','L': 'Y',",
+ " 'M': 'Z','N': 'A','O': 'B','P': 'C',",
+ " 'Q': 'D','R': 'E','S': 'F','T': 'G',",
+ " 'U': 'H','V': 'I','W': 'J','X': 'K',",
+ " 'Y': 'L','Z': 'M' ",
+ "};",
+ "",
+ "function rot13(encodedStr) {",
+ " var codeArr = encodedStr.split(\"\"); // String to Array",
+ " var decodedArr = []; // Your Result goes here",
+ " // Only change code below this line",
+ " ",
+ " decodedArr = codeArr.map(function(letter) {",
+ " if(lookup.hasOwnProperty(letter)) {",
+ " letter = lookup[letter];",
+ " }",
+ " return letter;",
+ " });",
+ "",
+ " // Only change code above this line",
+ " return decodedArr.join(\"\"); // Array to String",
+ "}"
],
"type": "bonfire",
"challengeType": "5",