Ily*_*bin 4 javascript string unicode emoji
我正在尝试转换统一的表情符号串.
尝试执行此操作时出错:
var code = '1f628'
`\u{${code}}`
Run Code Online (Sandbox Code Playgroud)
SyntaxError:无效的Unicode转义序列
我怎样才能使它工作?
Aux*_*aco 10
String.fromCodePoint将从数字代码点获取字符,并parseInt从十六进制字符串中获取数字:
var code = '1f628';
String.fromCodePoint(parseInt(code, 16)); //
Run Code Online (Sandbox Code Playgroud)