Chrome支持ES6字符串模板解析

Chrome支持ES6字符串模板解析

浏览次数:次 OurJS 2014年12月16日 字号: 大 中 小

Addy Osmani 是Google Chrome开发团队的工程师,近日他在其Twitter中宣布,ES6字符串模板已经可以在Chrome中工作。你可以在字符串文字中嵌入表达式,(此功能尚未发布)。以前此类功能多由第三方JavaScript模板引擎库来实现,如Mustache, jQuery Templates, doT.js, ejs等。目前还不清楚此功能对性能的影响。

示列:

> var persion = "Alex Russell";

console.log('Yo! My name is ${person}!');

> Yo! My name is Alex Russell!

下图来自其Twitter:




转载请注明:http://www.soiphoto.com/fzqs/fzqs/8.html