string方法中字符与Unicode编码的相互转化:fromCharCode(),charCodeAt()
String.fromCharCode(num1,num2,...numX)
将Unicode编码转字符串
console.log(String.fromCharCode(65)) //A
//根据Unicode输出A-D
for(let i=65;i<=90; i++){let k = String.fromCharCode(i)console.log(k)}
str.charCodeAt(index)
返回指定位置的字符对应的Unicode编码
let str = 'AB'
console.log(str.charCodeAt(0)) //65
本文来自博客园,作者:叶子玉,转载请注明原文链接:https://www.cnblogs.com/knuzy/p/11102524.html