Skip to content

Instantly share code, notes, and snippets.

@mrienstra
Last active September 28, 2024 16:05
Show Gist options
  • Save mrienstra/8aa4eeeeab2012d2aa8ffc7f5e45f280 to your computer and use it in GitHub Desktop.
Save mrienstra/8aa4eeeeab2012d2aa8ffc7f5e45f280 to your computer and use it in GitHub Desktop.
await new Promise(function (resolve) {
setTimeout(function () {
resolve();
}, 1000);
});
// ... Can be shortened to:
await new Promise(function (resolve) {
setTimeout(resolve, 1000);
});
// ... Can be shortened to:
await new Promise((resolve) => {
setTimeout(resolve, 1000);
});
// ... Can be shortened to:
await new Promise((resolve) => setTimeout(resolve, 1000));
// ... Can be shortened to:
await new Promise(resolve => setTimeout(resolve, 1000));
@Yn8en
Copy link

Yn8en commented Nov 5, 2021

very nice & clear explanation, laid out very well!
I like it, to the point!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment