字符串模板
2019-07-04 本文已影响0人
夜色微微良
支持在字符串中插入变量,格式为${},注意字符串必须用`` ( Esc键下面,1键左边的 ) 包裹
var name = 'forrest';
console.log(`hello ${name}`); // hello forrest
var getName = function (){
return 'forrest';
}
console.log(`hello ${getName()}`); // hello forrest