Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function timeout(ms) {
- return new Promise(resolve => setTimeout(resolve, ms));
- };
- async function sleep (forHowLong) {
- await timeout(forHowLong);
- };
- async function asyncFn () {
- await sleep(0);
- console.log(3);
- await sleep(1000);
- console.log(2);
- await sleep(1000);
- console.log(1);
- await sleep(1000);
- console.log('DONE');
- };
- asyncFn();
Advertisement
Add Comment
Please, Sign In to add comment