sleep()在ES7中利用Promise和async/await的優雅實現

sleep()的優雅實現 演示 var sleep = async (duration) => { return new Promise((resolve, reject) => { setTimeout(resolve, duration); }); }; (async () => { console.log("start!"+new Date().toISOString()); con
相關文章
相關標籤/搜索