mirror of
https://github.com/ruanyf/es6tutorial.git
synced 2024-04-21 12:32:22 +00:00
docs(array): fix flatMap
This commit is contained in:
+1
-1
@@ -790,7 +790,7 @@ contains(['foo', 'bar'], 'baz'); // => false
|
||||
|
||||
```javascript
|
||||
// 相当于 [[[2]], [[4]], [[6]], [[8]]].flat()
|
||||
[1, 2, 3, 4].flatMap(x => [[x * x]])
|
||||
[1, 2, 3, 4].flatMap(x => [[x * 2]])
|
||||
// [[2], [4], [6], [8]]
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user