Return value of Promise's resolve/reject functions

后端 未结 1 752
悲&欢浪女
悲&欢浪女 2020-12-06 18:39

Consider this situation.

new Promise(function(resolve, reject) {
    var x = resolve(2);
});

What value will x be? I tried to

1条回答
  •  醉酒成梦
    2020-12-06 19:18

    The return value of the promise constructor is ignored.

    The resolve function also returns undefined.

    This was first specified in the promise constructor spec and later in the ES2015 (ES6) language specification.

    0 讨论(0)
提交回复
热议问题