//#1 返回promise实例给then
doSomething().then(()=>{
return doSomethingElse();
})
//执行步骤
dosomething=>doSomethingElse(undefined)=>finalHandler(result of dosomethingElse)
//#2 不返回promise实例给then相当于返回空
doSomething().then(()=>{
doSomethingElse();
})
//执行步骤
dosomething=>dosomethingElse(undefined)=>finalHandler(undefined)
//#3then里面立即执行函数返回的是promise实例,且和dosomething 同时执行,在同一个栈中执行
doSomething().then(doSomethingElse());
//执行步骤
dosomething() => finalHandler(result of dosomething)
dosomethingElse(undefined)=>
//#4 dosomethingElse作函数传进去,then中默认可以传两个函数作为参数(resolve,reject)
doSomething().then(doSomethingElse);
//执行步骤
dosomething=>dosomethingElse(result of dosomething)=>finalHandler(result of dosomethingElse)