Appearance
透传
本节目标:理解“透传”的核心思路,并能把它用于实际开发或面试表达。
then(onFulfilled, onRejected) { // Promise.prototype.then
//可选参数的含义就是用户不给 就用默认的
onFulfilled = typeof onFulfilled === 'function' ? onFulfilled : v => v
onRejected = typeof onRejected === 'function' ? onRejected : err => { throw err }