JavaScript基礎知識-Unicode編碼表
作者:尹正傑
版權聲明:原創作品,謝絕轉載!否則將追究法律責任。
Unicode的編碼表也被稱為萬國碼,里面包含了各種字符編碼(https://www.unicode.org/charts/)。
一.JavaScript源代碼
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Unicode編碼表</title>
<script type="text/javascript">
/**
* 在字符串中使用轉義字符輸入Unicode編碼,"\u"四位十進制編碼。
*/
console.log("\u2620");
console.log("\u2680");
console.log("\u2681");
console.log("\u2682");
console.log("\u2683");
console.log("\u2684");
console.log("\u2685");
console.log("\u2660");
console.log("\u2661");
console.log("\u2662");
console.log("\u2663");
</script>
</head>
<body>
<!--
在網頁中使用Unicode編碼,"&#編碼;"這里的編碼需要的是10進制。
-->
<h1 style="font-size: 50px;">♠</h1>
<h1 style="font-size: 50px;">♡</h1>
<h1 style="font-size: 50px;">♢</h1>
<h1 style="font-size: 50px;">♣</h1>
</body>
</html>
二.瀏覽器打開以上代碼渲染結果

