模板字符串
语法
其中最重要的是:`${变量}`,不能没有这个。
//`${变量}`
var message='world'
var str=`hello:${message}`
console.log(str)//输出:hello:world
作用
1、字符串拼接
2、换行
//1、字符串拼接
var a=10
var b=20
var c=`${a}+${b}=${a+b}`
console.log(c)//输出:10+20=30
//2、换行
var str=`<div>
<h2>模板的换行作用</h2>
<p>hahahawdeuf</p>
<p>hahahawdeuf</p>
</div>`
document.write(str)
严格模式
JavaScript默认的不是严格模式
不严格的体现
1、变量不声明也可以使用
2、函数形参可以重复
开启严格模式
'use