[[String.prototype.codePointAt]]を使う。 ```ts function toCodePoints(str: string): string { return Array.from(str).map((char) => char.codePointAt(0) ?? 0).map((x) => `U+${x.toString(16).toUpperCase().padStart(4, "0")}` ).join(" "); } console.log(toCodePoints("a")); // U+0061 console.log(toCodePoints("あ")); // U+3402 console.log(toCodePoints("😊")); // U+1F60A ``` ## MOC - 📒**関連** - [[コードポイントを文字列に変換 (JavaScript)|コードポイントを文字列に変換]] - 📜**アクティビティ** - 📝**トラブルシューティング**