将字符转为ASCII码

var str = "A";
str.charCodeAt();  // 65

var str1 = 'a';
str1.charCodeAt();  // 97

将ASCII码转为字符

var num = 97;
String.fromCharCode(num);  // 'a'

var num1 = 100;
String.fromCharCode(num1);  // 'd'