1.
`${}`
`string` 是模板字符串,ES2015新增的符号。
其实是这样的 ${}里边 依旧是js,外边也是js
var a = 1;
console.log('一共有'+a+'个鸡蛋!')
那么现在你只要
console.log(`一共有${a}个鸡蛋!`)
1.
`${}`
`string` 是模板字符串,ES2015新增的符号。
其实是这样的 ${}里边 依旧是js,外边也是js
var a = 1;
console.log('一共有'+a+'个鸡蛋!')
那么现在你只要
console.log(`一共有${a}个鸡蛋!`)