Skip to content

Latest commit

 

History

History
31 lines (21 loc) · 950 Bytes

File metadata and controls

31 lines (21 loc) · 950 Bytes

JavaScript-Algorithms-and-Data-Structures-Projects-Caesars-Cipher

Caesars Cipher

function rot13(str) { // LBH QVQ VG!

//Do not transform any non-alphabetic character (i.e. spaces, punctuation), but do pass them on.

//str = the value of the letters are shifted by 13 places

var ourArray = [str];

var i = 0;

while(i < ourArray.length) {
 
  console.log(ourArray[i]);

//I want to print each letter of the array, perhaps .splice

i++;
}
  return str;
}

// Change the inputs below to test
rot13("SERR PBQR PNZC"); //should decode to FREE CODE CAMP
rot13("SERR CVMMN!"); // should decode to FREE PIZZA!
rot13("SERR YBIR?"); // should decode to FREE LOVE?
rot13("GUR DHVPX OEBJA SBK WHZCF BIRE GUR YNML QBT."); // should decode to THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG.