回答編集履歴
1
thenの連結について補足
answer
CHANGED
@@ -20,6 +20,13 @@
|
|
20
20
|
|
21
21
|
一つ前のthenに渡した関数でreturnしたものが、次のthenの引数として渡ります。
|
22
22
|
```js
|
23
|
+
/*
|
24
|
+
result = [
|
25
|
+
{id: 1, name: 'Alice'},
|
26
|
+
{id: 2, name: 'Bob'},
|
27
|
+
{id: 3, name: 'Charlie'}
|
28
|
+
]; の場合
|
29
|
+
*/
|
23
30
|
.then(result => result.map(name => name.id))
|
24
|
-
.then(ids =>
|
31
|
+
.then(ids => { console.log(ids); }) // [1, 2, 3]
|
25
32
|
```
|