then 方法来实现,当 promise 完成 resolve 时会触发 then 方法。例子如下:
```js
myPromise.then(result => {
// do something with the result.
});
```
result 即传入 resolve 方法的参数。
then 方法。用 result 做为回调函数的参数并将 result 打印在控制台。
then 方法。
testString: assert(codeWithoutSpaces.match(/(makeServerRequest|\))\.then\(/g));
- text: then 方法应该有一个回调函数,回调函数参数为 result。
testString: assert(resultIsParameter);
- text: 应该打印 result 到控制台。
testString: assert(resultIsParameter && codeWithoutSpaces.match(/\.then\(.*?result.*?console.log\(result\).*?\)/));
```