642190
function time() {
a();
console.log("love");
}
function a() { setTimeout(function () { console.log("gun");
},3000)
}
time();
function time() {
a();
console.log("love");
}
function a() { setTimeout(function () { console.log("gun");
},3000)
}
time();
var a = function () {
return new Promise(function (resolve, reject) {
setTimeout(function () {
console.log('gun');
resolve();
}, 3000);
});
};
var time = async function () {
await a();
console.log('love');
};
time();
感觉没懂
function sleepSync(time){ return new Promise((resolve,reject)=>{ setTimeout(function(){ resolve(); },time); }) } async bin(){ await sleepSync(500); }
今天刚碰到异步变同步问题感觉好棘手,高手们支援一下!