Answers for "rot13 js"

2

rot13 js

// best
function rot13(message) {
  var a = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
  var b = "nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM";
  return message.replace(/[a-z]/gi, (c) => b[a.indexOf(c)]);
}
Posted by: Guest on June-19-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language