2 ms·
OK. I'll do: const result = await get() set(result) But you do you. Current node and console have top level await BTW.
by nailer 6y ago
OK. I'll do:
const result = await get()
set(result)
But you do you.
Current node and console have top level await BTW.
- postalrat 6y agoThat only works in an async function. The then example doesn't have that requirement. So the alternative shouldn't either.
- nailer 6y agoYes, your example isn't complaining about then() being clearer than await (because it isn't) but rather complaining that top level await isn't everywhere yet. In other words, your complaints have disappeared in node, and will soon in browsers: https://github.com/tc39/proposal-top-level-await https://github.com/tc39/proposal-top-level-await So yes: set(await get())