字符串转Unicode码

var str = '中';

var charCode = str.charCodeAt(0);

console.log(charCode); // => 20013;

str.charCodeAt(0).toString(16);//=>"4e2d"

原文地址:https://www.cnblogs.com/alvin553819/p/7127312.html