📜  rot13 js - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:33.403000             🧑  作者: Mango

代码示例1
// best
function rot13(message) {
  var a = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
  var b = "nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM";
  return message.replace(/[a-z]/gi, (c) => b[a.indexOf(c)]);
}