Skip to content

Commit f15c49e

Browse files
authored
feat: 每日一题2019-07-25 (azl397985856#1)
每日一题2019-07-25
2 parents 640d9d2 + 32e4328 commit f15c49e

File tree

2 files changed

+39
-1
lines changed

2 files changed

+39
-1
lines changed

docs/daily/2019-07-25.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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的返回值

docs/daily/README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,10 @@
99

1010
tag: `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

0 commit comments

Comments
 (0)