var count= 0;
var intervalTime = 1000;
var intervalId = null;
function timeOutFun(){
count++;
console.log("timeOutFun——"+count);
if(executeTimes<5){
setTimeout(arguments.callee,intervalTime);
}
}
arguments.callee可以代替递归函数
function a(){
return new Promise((resolve,reject)=>{
setTimeout(()=>{
console.log('a')
resolve()
},100);
})
}
async function b(){
await a()
console.log('b')
}
利用async await和setTimeout,顺序输出a,b。