请问如何避免报错呢?我应该思路就是错的, 求解决思路
var obj = {
ok: null,
cancel: null
};
function fn() {
return new Promise((resolve, reject) => {
obj.ok = resolve;
obj.cancel = reject;
});
}
fn();
obj.cancel(); // Uncaught (in promise) undefined
慕码人2483693
相关分类