function call(cb){
console.log(Date.now())
const res = {
status:0
}
setTimeout(function(){
cb(res);
},1000);
}
function fun1(){
return new Promise((resolve) =>{
call((res) => {
// if(res.status == '0'){
// console.log(3)
// resolve();
// } else {
// call(res => {
// resolve();
// })
// }
console.log(2)
resolve(3)
console.log(Date.now())
})
})
}
function fun2(){
console.log(4)
setTimeout(function(){
console.log(6)
},0)
return new Promise((resolve) =>{
call(() => {
console.log(5)
resolve()
console.log(Date.now())
})
})
}
// fun2();
async function fun3(){
let a = await fun1();
console.log(a);
await fun2();
}
async function init(){
console.log(1)
await fun3()
console.log(7)
}
init();
console