Last active
June 30, 2020 17:20
-
-
Save serdarcevher/8f278aef1b39f67d4b194ba5bb3674af to your computer and use it in GitHub Desktop.
A very basic example to use async await
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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