ES6基础之——模版字符串Template Strings
例子:
let dessert = 'cake', drink = 'tea'
如果想把dessert和drink连成一句话
方法一:字符串拼接
let breakfast = "今天的早餐是" + dessert + "与" + drink + "!"; console.log(breakfast); //今天的早餐是cake与tea!
方法二:ES6字符模版
let breakfast = `今天的早餐是${dessert}与${drink}!`; console.log(breakfast); //今天的早餐是cake与tea!