codePointAt()
这个方法完全支持UTF-16,接受编码单元的位置而非字符位置作为参数,返回与字符串中给定位置对应的码位,即一个整数值。
let text='吉a';
console.log(text.charCodeAt(0)); //55362
console.log(text.charCodeAt(1)); //57271
console.log(text.charCodeAt(2)); //97
console.log(text.codePointAt(0)); //134071
console.log(text.codePointAt(1)); //55362
console.log(text.codePointAt(2)); //55362
String.fromCodePoint()
console.log(String.fromCodePoint(134071); //"吉"