Sure, but then it’s not really synchronous, you just write the code in a way that looks synchronous.
But maybe they’re in a situation where they can’t use async/await, like at the top level on a runtime that doesn’t support top-level await (although I guess they could just stick it in an async IIFE in that case) or maybe they’re writing JS for something like the Espruino.
They probably could’ve used async/await given that this looks like either Typescript or Flow (which means it’d probably be transpiled anyways), but I’m just nitpicking that it wouldn’t really be synchronous in that case.
View all comments
Show parent comment
0
u/niceToasterMan Mar 25 '22
Can't async await in JS?