promise不会被return触发, 一个promise对象中不会被Promise.reject触发

  • Post author:
  • Post category:其他


1.

let a = new Promise((resolve,reject)=>{

return 23

})



a;

// promise <pending>

2.

let a = new Promise((resolve,reject)=>{

Promise.reject(234)

})



a;

// promise <pending>

3.

let a = new Promise((resolve,reject)=>{

return Promise.reject(12)

}



a;

//promise <pending>


https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/reject

转载于:https://www.cnblogs.com/eret9616/p/11546529.html