Skip to content

Instantly share code, notes, and snippets.

@serdarcevher
Last active June 30, 2020 17:20
Show Gist options
  • Save serdarcevher/8f278aef1b39f67d4b194ba5bb3674af to your computer and use it in GitHub Desktop.
Save serdarcevher/8f278aef1b39f67d4b194ba5bb3674af to your computer and use it in GitHub Desktop.
A very basic example to use async await
<script>
const waitFor = (ms) => new Promise(r => setTimeout(r, ms));
async function printMessages() {
document.write('Birinci mesaj');
await waitFor(2000);
document.write('İkinci mesaj');
}
printMessages();
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment