svandijk
svandijk

Reputation: 1

How do you use a key to generate new code when using charCodeAt()?

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

Answers (1)

Free Consulting
Free Consulting

Reputation: 4402

var plainText = "watergate";
var cipherText = "";
for ( var i = 0; i < plainText.length; i++ )
  cipherText += String.fromCharCode( plainText.charCodeAt(i) + 42 );

Upvotes: 1

Related Questions