File tree Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -156,17 +156,24 @@ function final(value) {
156
156
console .log (' 完成: ' , value);
157
157
}
158
158
159
- async (1 , function (value ){
160
- async (value , function (value ){
161
- async (value , function (value ){
162
- async (value , function (value ){
163
- async (value , function (value ){
164
- async (value , final);
159
+ async (1 , function (value ) {
160
+ async (2 , function (value ) {
161
+ async (3 , function (value ) {
162
+ async (4 , function (value ) {
163
+ async (5 , function (value ) {
164
+ async (6 , final);
165
165
});
166
166
});
167
167
});
168
168
});
169
169
});
170
+ // 参数为 1 , 1秒后返回结果
171
+ // 参数为 2 , 1秒后返回结果
172
+ // 参数为 3 , 1秒后返回结果
173
+ // 参数为 4 , 1秒后返回结果
174
+ // 参数为 5 , 1秒后返回结果
175
+ // 参数为 6 , 1秒后返回结果
176
+ // 完成: 12
170
177
```
171
178
172
179
上面代码中,六个回调函数的嵌套,不仅写起来麻烦,容易出错,而且难以维护。
You can’t perform that action at this time.
0 commit comments