js中可选的回调函数

1、then的回调函数不是严格要求必写的。如果不写,promise也会用上一个返回的最终值来传递。
doSomething()
.then()
.then(function(result) {
console.log('got a result', result);
}); // 输出结果是://// got a result 42
2、如果当前的then没有传输回调函数,该函数将直接使用前一个promise返回的最终值来解决下一个promise。
if (!handler.onResolved) {
handler.resolve(value);
return;
}




