【发布时间】:2016-09-11 18:09:31
【问题描述】:
我想尝试使用template literals,但它不起作用:它显示的是文字变量名称,而不是值。我正在使用 Chrome v50.0.2(和 jQuery)。
示例
console.log('categoryName: ${this.categoryName}\ncategoryElements: ${this.categoryElements} ');
输出
${this.categoryName}
categoryElements: ${this.categoryElements}
【问题讨论】:
-
使用重音 ` 而不是单引号
'或双引号"。
标签: javascript template-literals