Hacker News new | ask | show | jobs
by the-lazy-guy 588 days 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; }