【Promise第13题】下面代码的输出是什么?
js
const promise = new Promise((resolve, reject) => { resolve("success1"); reject("error"); resolve("success2"); }); promise .then(res => { console.log("then: ", res); }).catch(err => { console.log("catch: ", err); })
## 参考答案:
## 解析
构造函数中的 resolve 或 reject 只有第一次执行有效,多次调用没有任何作用 ,Promise的状态一经改变就不能再改变。
## 结果"then: success1"