Java Nashorn - 模板字符串
Java Nashorn - template strings
Java Nashorn 支持 JavaScript template strings 吗?
尝试 var a = `this is a \n multiline string \n `
时出现以下错误:
javax.script.ScriptException: <eval>:1:22 Expected an operand but found error
使用 Nashorn "scripting mode"(通过 jjs 的 -scripting 选项启用,并且 -Dnashorn.args 系统 属性 可用于 javax.script 设置选项),有多行字符串和字符串插值的 Nashorn 特定扩展。
另请参阅:
如前所述,ES6 功能正在添加到 jdk9。您可以使用 --language=es6 选项启用 es6 功能(子集)
Java Nashorn 支持 JavaScript template strings 吗?
尝试 var a = `this is a \n multiline string \n `
时出现以下错误:
javax.script.ScriptException: <eval>:1:22 Expected an operand but found error
使用 Nashorn "scripting mode"(通过 jjs 的 -scripting 选项启用,并且 -Dnashorn.args 系统 属性 可用于 javax.script 设置选项),有多行字符串和字符串插值的 Nashorn 特定扩展。
另请参阅:
如前所述,ES6 功能正在添加到 jdk9。您可以使用 --language=es6 选项启用 es6 功能(子集)