Skip to content

Instantly share code, notes, and snippets.

@zibellon
Created October 29, 2022 14:17
Show Gist options
  • Save zibellon/1eddb6543152b2941e7b9730ce93bb2b to your computer and use it in GitHub Desktop.
Save zibellon/1eddb6543152b2941e7b9730ce93bb2b to your computer and use it in GitHub Desktop.
example promise
function funAsync() {
return new Promise((resolve, reject) => {
setTimeout(() => {
console.log('ASYNC END');
// resolve()
reject("asdasdads");
}, 3000);
})
}
async function start() {
await funAsync().catch(e => {});
console.log('1 OUT');
try {
await funAsync();
console.log('2 OUT');
} catch (error) {
}
await funAsync();
console.log('3 OUT');
}
start();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment