Skip to content

[js] 第598天 promise有哪几种状态?是如何变化的? #3265

Open
@haizhilin2013

Description

@haizhilin2013
Collaborator

第598天 promise有哪几种状态?是如何变化的?

3+1官网

我也要出题

Activity

zsgww

zsgww commented on Dec 4, 2020

@zsgww

待定(pending): 初始状态。
已兑现(fulfilled):操作成功。
已拒绝(rejected):操作失败。
从pending到fulfilled,或者pending到rejected。

wChenonly

wChenonly commented on Dec 4, 2020

@wChenonly

1.pending(初始状态)
2.调用resolve(成功),pending->fulfilled
3.调用reject(失败),pending->rejected
而且状态改变以后,就不能在变了

a62527776a

a62527776a commented on Dec 8, 2020

@a62527776a

Promis分别有pending 状态 fulfilled状态 以及rejected状态
当调用resolve或者reject之后的就会变为 转为相应的状态 这两种状态 又称 settled状态

进入settled状态 会触发finally回调

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    jsJavaScript

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @haizhilin2013@a62527776a@wChenonly@zsgww

        Issue actions

          [js] 第598天 promise有哪几种状态?是如何变化的? · Issue #3265 · haizlin/fe-interview