中文用户可以访问 中文站

Convert emoji character to Unicode number in JavaScript

console.log(‘☃★♲’.codePointAt(1)); // output: “9733” console.log(String.fromCodePoint(9731, 9733, 9842, 0x2F804)); // output: “☃★♲你” let hex = “😀”.codePointAt(0).toString(16); console.log(hex); // output: 1f600 console.log(String.fromCodePoint(“0x”+hex)); // output: 😀 Unicode encode/Unicode decode/Emoji encode/Emoji decode