js中字母和ascii码互相转换
- 将字母转为ascii码的方法:
var MrFlySand = "A";
MrFlySand.charCodeAt();// 65
var FlySand= 'a';
FlySand.charCodeAt();// 97
- 将ascii码转为对应字母的方法:
var MrFlySand = 97;
String.fromCharCode(MrFlySand); // 'a'
var FlySand = 100;
String.fromCharCode(FlySand); // 'd'