Javascript SyntaxError: Unexpected token ILLEGAL when trying to use emoji's UTF code

Javascript SyntaxError: Unexpected token ILLEGAL when trying to use emoji's UTF code

我想将表情符号作为 UTF-8 代码添加到我的字符串中:

var c11 = new Road('/hl','\u{1F1F3-1F1F1} netherlands', node4);

根据link,它是荷兰国旗表情符号UTF-8编码。当我启动我的 javascript 应用程序时,它抛出了这个错误:

var c11 = new Road('/hl', '\u{1F1F3-1F1F1} netherlands', node4);
                     ^^^^^^^^^

SyntaxError: Unexpected token ILLEGAL
at exports.runInThisContext (vm.js:53:16)

当我写其他没有破折号的表情符号时(例如 \u{1F338}),效果很好。为什么我不能使用标志?

只需使用 \u{1F1F3}\u{1F1F1} 而不是 \u{1F1F3-1F1F1}