JavaScript 获取某个字符的 Unicode 码

function getUnicode (charCode) {
	return charCode.charCodeAt(0).toString(16);
}

获取的是 UTF-16 编码的值,不足4位的话在前面补0。
最终的 Unicode 码格式:uxxxx

原文地址:https://www.cnblogs.com/xiaoyucoding/p/10019982.html