File tree Expand file tree Collapse file tree 2 files changed +39
-1
lines changed
Expand file tree Collapse file tree 2 files changed +39
-1
lines changed Original file line number Diff line number Diff line change 1+ ## 每日一题 - 以下四个promise有什么不同
2+
3+ ### 信息卡片
4+
5+ - 时间:2019-07-25
6+ - tag:` ES6 ` ` Promise `
7+
8+ ### 题目描述
9+
10+ ``` js
11+ doSomething ().then (function () {
12+ return doSomethingElse ();
13+ });
14+
15+ doSomething ().then (function () {
16+ doSomethingElse ();
17+ });
18+
19+ doSomething ().then (doSomethingElse ());
20+
21+ doSomething ().then (doSomethingElse);
22+ ```
23+ ### 考察点
24+
25+ ` Promise的then方法 `
26+
27+ ### 参考答案
28+
29+ 1 . then方法提供一个自定义的回调函数,若传入非函数,则会忽略当前then方法。
30+ 2 . 在回调函数中会把上一个then中返回的值当做参数值供当前then方法调用。
31+ 3 . then方法执行完毕后需要返回一个新的值给下一个then调用(没有返回值默认使用undefined)。
32+ 4 . 每个then只可能使用前一个then的返回值
Original file line number Diff line number Diff line change 99
1010tag: ` Array `
1111
12- 时间:2019-07-22
12+ 时间:2019-07-22
13+
14+ #### [ 以下四个promise有什么不同] ( ./2019-07-25.md )
15+
16+ tag: ` ES6 ` ` Promise `
17+
18+ 时间:2019-07-25
You can’t perform that action at this time.
0 commit comments