【Promise第二题】
参考答案
判定
then 中的回调如果返回 rejected Promise 或 throw,则链进入 rejected,后续 then 被跳过,直到遇到 catch。
因此输出可能只到某个 then 就中断,之后只输出 catch 中的内容;若 catch 返回普通值,链恢复并继续后续 then。
【Promise第二题】
then 中的回调如果返回 rejected Promise 或 throw,则链进入 rejected,后续 then 被跳过,直到遇到 catch。
因此输出可能只到某个 then 就中断,之后只输出 catch 中的内容;若 catch 返回普通值,链恢复并继续后续 then。
本题来自 计算机知识面试题库,共 921 道题。