const sleep = (wait)=>{ return new Promise((resolve)=>{ setTimeout(resolve,wait) }) } (async()=>{ for(let i =0;i<6;i++){ if(i<5){ console.log(new Date(),i); await sleep(1000) }else{ await sleep(4000) console.log(new Date(),i); } } })()