1—>字母转换为ASCll
var temp="ABCD";
bytes=[];
if(temp.length <= 4) {
for (var i = 0; i <temp.length ; i++) {
bytes[i] = temp.charCodeAt(i);
}
}
for (var i = 0; i <bytes.length ; i++) {
console.log("bytes=="+i+"==="+bytes[i]);
}
输出结果
bytes==0===65
bytes==1===66
bytes==2===67
bytes==3===68
2—>ASCll转换为字母
var num = 65;
var value1=String.fromCharCode(num);
console.log(value1) // A