<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script>
Promise.reject().then(() => {
console.log('13');
}, () => {
console.log('6');
})
new Promise((resolve) => {
console.log('7');
resolve();
}).then(() => {
console.log('8')
})
</script>
</body>
</html>
执行结果是7,6,8 。
不明白为什么Promise.reject会执行呢?
.then(f, g)
相当于.then(f).catch(g)