Skip to content

Instantly share code, notes, and snippets.

@allenhwkim
Created April 18, 2018 18:15
Show Gist options
  • Select an option

  • Save allenhwkim/0f4976f511eebe1c28fb6345d59c9a5f to your computer and use it in GitHub Desktop.

Select an option

Save allenhwkim/0f4976f511eebe1c28fb6345d59c9a5f to your computer and use it in GitHub Desktop.
Javascript Simple Encoding
function simpleEncoding(str, num=10) {
return str.split('').map(c => String.fromCharCode(c.charCodeAt(0)+num)).join('');
}
var encoded = simpleEncoding('hello world'); // 'rovvy*y|vn'
simpleEncoding(encoded, -10); // 'hello world'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment