一.字符串:
1、多行字符串,使用双撇号进行换行
`hello
hello`
2、字符串模板(引用变量)。
var a = 5
console.log(`${a}`);
3、自动拆分字符串(字符串模板调用方法test,自动将模板里字符拆分为第一个变量template,整个模板的表达式会被拆分成一个数组,并将该数组当成实参传入方法所用来接收的形参。
function test(template,name,age){
console.log(template);
console.log(name);
console.log(age);
}
var name = 'chen';
var getAge=function(){
return 18;
}
test`hello my name is ${name},i am ${getAge()}`,