JavaScript字符编解码
示例代码:
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>JavaScript字符串编解码</title>
</head>
<body>
<script>
var str = 'a';
//字符的 Unicode 编码
var unicode = str.charCodeAt(0);
console.log(unicode);
//字符解码
var strNew = String.fromCharCode(unicode);
console.log(strNew);
</script>
</body>
</html>
作者:孟繁贵 Email:meng010387@126.com 期待共同进步!