将数字转化为字母
String.fromCharCode(64 + index)
其中的 index 是索引值,其实确切的说 index 只需要是一个整数值就可以,'A' 这个值为 65,也就是 index值为1 的时候
eg:
String.formCharCode(64 + 1) // 'A'
其他的后面的值就是一个个加上去就好了
相关资料链接: String.fromCharCode()
将字母转化为数字
String.charCodeAt()
这里的index也是索引值
eg:
const listItem = 'ABCDEFGHIJK'
listItem.charCodeAt(0) // '65'
相关的资料链接: String.charCodeAt()