add: 模板字面量

This commit is contained in:
qianguyihao
2020-06-06 23:50:36 +08:00
parent 956b6850ad
commit 03a3841ab0
9 changed files with 130 additions and 67 deletions

View File

@@ -151,7 +151,7 @@ console.log(typeof a); //输出结果string
![](http://img.smyhvae.com/20180304_1626.png)
## for ... of 循环
## for of 循环
ES6 如果我们要遍历一个数组可以这样做
@@ -169,11 +169,11 @@ ES6 中,如果我们要遍历一个数组,可以这样做:
forof 的循环可以避免我们开拓内存空间增加代码运行效率所以建议大家在以后的工作中使用forof循环
注意上面的数组中`for ... of`获取的是数组里的值`for ... in`获取的是index索引值
注意上面的数组中`for of`获取的是数组里的值`for in`获取的是index索引值
### Map对象的遍历
`for ... of`既可以遍历数组也可以遍历Map对象
`for of`既可以遍历数组也可以遍历Map对象
## 模板字符串