const sleep = (timeountMS) => new Promise((resolve) => {
setTimeout(resolve, timeountMS);
});
(async () => {
console.log('11111111, ' + new Date());
await sleep(2000);
console.log('22222222, ' + new Date());
await sleep(2000);
console.log('33333333, ' + new Date());
})();
标签:JavaScript,console,log,await,sleep,Date,new
From: https://blog.51cto.com/u_14682436/6196406