这个:
`The area of a circle of radius 4 is ${circle.area(4)}`是ES2015模板字符串的示例。
它将任何
circle.area(4)表示直接插值到字符串中。如果您对此功能或其他ES2015功能感到好奇,建议您查看Babel并尝试使用REPL。
这是一个非常简单的示例,可以帮助您入门。
您可以看到以下ES2015代码:
const foo = 'some text';console.log(`${foo} is interpolated.`);被转换为其等效的ES5-一个简单的
+串联:
var foo = 'some text';console.log(foo + ' is interpolated.');



