We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I have this simple test script:
async function test() { return 42; } let x = await test();
And I run it using the command babel-node --stage 0 await-test.js and I get this:
babel-node --stage 0 await-test.js
SyntaxError: /Users/foo/bar/await-test.js: Unexpected token (5:14) 3 | } 4 | > 5 | let x = await test(); | ^
babel-node --version 5.6.14
What am I doing wrong?
The text was updated successfully, but these errors were encountered:
await can only be on the inside of async functions.
await
async
Sorry, something went wrong.
Well that was fast :D. Thanks! So from an non-async function we must resolve the returned promise. Makes sense now that I think about it.
async function test() { return 42; } async function main() { return await test(); } main().then(function (res) { console.log(res); });
Yup, there's no way to block execution outside of them.
No branches or pull requests
I have this simple test script:
And I run it using the command
babel-node --stage 0 await-test.js
and I get this:What am I doing wrong?
The text was updated successfully, but these errors were encountered: