Hacker News new | past | comments | ask | show | jobs | submit login

[removed]



Nothing would change here.

Normally, await can only appear in a method that has been marked as async. However, when you write toplevel code (code that's not wrapped in a function), you can't mark the function as async (because there is no function) so you can't use await.

Enabling toplevel await fixes that.


Nothing. It's just that you can have

    const result = await someFetchOrSomething(str);
    return result.foo;
while not inside an async function. You still can't use it in a non-async function.


You can't return when you're not in a function ;-)




Consider applying for YC's W25 batch! Applications are open till Nov 12.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: