Skip to content

Instantly share code, notes, and snippets.

@mrienstra
Last active April 14, 2024 20:11
Show Gist options
  • Star 25 You must be signed in to star a gist
  • Fork 6 You must be signed in to fork a gist
  • 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