1:字符的Unicode表示法
2:字符串的遍歷器接口
for (let codePoint of 'foo') {
console.log(codePoint)
}
// "f"
// "o"
// "o"
3:直接輸入U(xiǎn) + 2028 和 u + 2029
4:JSON.stringify的改造
5:模板字符串
let str = `
There are <b>${basket.count}</b> items
in your basket, <em>${basket.onSale}</em>
are on sale!
`;
如果使用模板字符串表示多行字符串力细,所有的空格和縮進(jìn)都會(huì)被保留在輸出之中阐斜。