JavaScript中的string interpolation

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals

var a = 5;
var b = 10;
console.log(`Fifteen is ${a + b} and
not ${2 * a + b}.`);
// "Fifteen is 15 and
// not 20."

 

需要注意的是ie不支持

 

posted @ 2018-06-21 17:21  ChuckLu  阅读(373)  评论(0编辑  收藏  举报