const promise = new Promise(function(resolve, reject) {
setTimeout(function() {
try{
let c = 6 / 2 ;
resolve(c);
} catch(ex) {
reject(ex);
}
}, 1000)
})
不知道怎么debug得出3来。
为啥是underfined?
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
</head>
<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);
}
}, 2000)
})
</script>
</body>
</html>