Created
December 6, 2019 05:10
-
-
Save daubattu/eac1e25754fe82f318615a652408c0d4 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// Written as of ES2019 | |
await Promise.resolve(console.log('π')); // β SyntaxError: await is only valid in async function | |
(async function() { | |
await Promise.resolve(console.log('π')); // β π | |
}()); | |
// Top level await | |
await Promise.resolve(console.log('π')); // β π |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment