chrome 消息队列的执行顺序2
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
</body>
<script>
console.log(-1);
let a = new Promise((resolve, reject) => {
console.log(1);
resolve(test())
console.log(2);
})
a.then(() => {
console.log(4);
})
function test() {
console.log(3);
}
console.log(0);
// -1 1 3 2 0 4
</script>
</html>