<!DOCTYPE html>
<html>
<body>
<script>
const promise = new Promise(function(resolve, reject) {
setTimeout(function() {
try{
let c = 6 / 2 ;
resolve(c);
console.log(resolve(c))
} catch(ex) {
reject(ex);
console.log(reject(ex))
}
}, 1000)
});
promise.then(function(value) {
console.log(value);
},function(err) {
console.error(err.message);
})
</script>
</body>
</html>
原来是这样console.log的promise,但是拒绝也没出来
最新推荐文章于 2023-04-11 17:48:18 发布