mirror of
https://github.com/ruanyf/es6tutorial.git
synced 2025-05-24 18:32:22 +00:00
add let
This commit is contained in:
parent
4e13461d83
commit
c04151cde4
@ -219,7 +219,7 @@ for (let x of set) {
|
|||||||
Set 结构的实例与数组一样,也拥有`forEach`方法,用于对每个成员执行某种操作,没有返回值。
|
Set 结构的实例与数组一样,也拥有`forEach`方法,用于对每个成员执行某种操作,没有返回值。
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
set = new Set([1, 4, 9]);
|
let set = new Set([1, 4, 9]);
|
||||||
set.forEach((value, key) => console.log(key + ' : ' + value))
|
set.forEach((value, key) => console.log(key + ' : ' + value))
|
||||||
// 1 : 1
|
// 1 : 1
|
||||||
// 4 : 4
|
// 4 : 4
|
||||||
|
Loading…
x
Reference in New Issue
Block a user