Last active
December 30, 2023 04:44
-
-
Save dig1t/56db72a3b1e6a674b43352160e731eb6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const yourAsyncFunction = async () => { | |
// do stuff | |
console.log('this will run first') | |
await new Promise((resolve, reject) => { | |
console.log('this will run second in 1000ms') | |
setTimeout(() => resolve(), 1000) | |
}) | |
// do stuff after waiting for the timeout to resolve | |
console.log('this will run last') | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment