es6TemplateString
使用ejs和multiline 实现ES6 Template String的功能
ES6 Template String 支持的功能
//Basic usage with an expression placeholdervar person = 'Hao Ju Zheng';console; //Expressions work just as well with object literalsvar user = name: 'Zhen Ou Yun';console; //Expression interpolation, One use is readable inline math.var a = 50;var b = 100;console; //Multi-line strings without needing \n\console; //Function inside expressions {return "result"}console;
浏览器支持情况
- firefox 34以上
- Chrome 马上会支持
详见ES6兼容表
使用ejs和multiline的实现的es6TemplateString
//Basic usage with an expression placeholdervar person = "Hao Ju Zheng"; console; //Expressions work just as well with object literalsvar user = name: "Zhen Ou Yun"; console; //Multi-line strings without needing \n\console; //Function inside expressions {return "result"}console;