A common misconception about async/await in JavaScriptby@luc.claustres
29,119 reads

A common misconception about async/await in JavaScript

tldt arrow
Read on Terminal Reader
Read this story w/o Javascript

Too Long; Didn't Read

Some developers tend to believe that the function written with async/await will always be executed synchronously. This is because the code looks like if we wait synchronously for the delayed operation before continuing the execution. Like with promises, it is up to the caller to decide if the code will run synchronously or not. That’s the reason why the code does not work as expected with constructs like for Each. If the caller does not make use of await(respectively then with promises) then your code will not run synchronous.
featured image - A common misconception about async/await in JavaScript
Luc Claustres HackerNoon profile picture

@luc.claustres

Luc Claustres

Digital Craftsman, Co-Founder of Kalisio, Ph.D. in Computer Science


Receive Stories from @luc.claustres

react to story with heart

RELATED STORIES

L O A D I N G
. . . comments & more!