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!
标签:ES6,dessert,drink,let,Template,tea,cake,breakfast,Strings 来源: https://www.cnblogs.com/fe-cherrydlh/p/11014040.html