3 ms·
No, it cant. These 2 are semantically not eqivalent, because in async version caller of f1() is resumed only once fetch has completed. In your callback version
by the-lazy-guy 2y ago
No, it cant. These 2 are semantically not eqivalent, because in async version caller of f1() is resumed only once fetch has completed. In your callback version it will be resumed immediately.
Also think how this should be translated:
function f1() {
x = await fetch('something');
return x + 1;
}