Skip to content

Instantly share code, notes, and snippets.

@nsacerdote
Last active October 2, 2020 12:32
Show Gist options
  • Save nsacerdote/03abc60f5fa8fb7f02c23b229006d124 to your computer and use it in GitHub Desktop.
Save nsacerdote/03abc60f5fa8fb7f02c23b229006d124 to your computer and use it in GitHub Desktop.
log('Waiting one second');
wait(1000)
.then(() => log('I waited for one second'))
.catch((err) => log('Something went wrong' + err));
log('Meanwhile checking twitter');
function wait(ms) {
return new Promise((resolve, reject) => {
log('Inside Promise ---> Started waiting')
setTimeout(() => resolve(), ms);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment