Reputation: 1
I have been working on my science fair project that is due in 3 days and I need help. I using charCodeAt(), however I don't know how to write the code that will use the key and charCodeAt() to create a new code. Please help.
Upvotes: 0
Views: 115
Reputation: 4402
var plainText = "watergate";
var cipherText = "";
for ( var i = 0; i < plainText.length; i++ )
cipherText += String.fromCharCode( plainText.charCodeAt(i) + 42 );
Upvotes: 1