Created
January 30, 2024 23:07
-
-
Save FauxFaux/f00effb64b4f84dc6747ec93e4eddf4c 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
async function throws() { | |
throw new Error('I threw!'); | |
} | |
async function main() { | |
const result = throws(); | |
console.log('seven'); | |
await sleep(10); | |
console.log('nine'); | |
await result; | |
} | |
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms)); | |
main().then(console.log).catch(console.error); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment