定义:
1、模版字符串使用` 反引号代替普通字符串的 ‘ 和 “
2、模版字符串 包含 ${expression} 形式的占位符。
3、在` `内使用 反引号 需要在前面加转义符 ` \``=== “ ` ” => true
作用:
1、模版字符串可以帮你获得多行字符串。
Str = "CC is studying." +
"CC is eating."
console.log(Str)Str2 = `CC is studying.
CC is eating.`
console.log(Str2)
2、模版字符串可以帮助你更优雅的插入表达式。
const a = 10
const b = 5
outPut = "Fifteen is " + (a+b) + "\nnot 20" outPut2 = `Fifteen is ${a+b}
not 20`…