An async function can contain an await expression, that pauses the execution of the async function and waits for the passed Promise's resolution, and then resumes the async function's execution and returns the resolved value.
Una función asíncrona puede contener una expresión await, que detiene la ejecución de la función asíncrona y espera la resolución de la Promise pasada, y después continúa la ejecución de la función async y devuelve el valor resuelto.
However, when converting the above to an async function, it's tempting to go too sequential
Sin embargo, cuando convertimos lo anterior en la función asincrónica, es tentador generar demasiadas secuencias
You can also define async functions using an async function expression. Syntax
También puedes definir funciones asíncronas usando una declaración async function. Sintaxis
Note that in the above example, there is no await statement on the return statement, because the return value of an async function is implicitly wrapped in Promise.resolve.
Nótese que el ejemplo anterior no tiene la instrucción await en la instrucción return, debido a que el valor devuelto por una función async se pasa implícitamente a través de Promise.resolvé.
It can only be used inside an async function. Syntax
Description An async function can contain an await expression that pauses the execution of the async function and waits for the passed Promise's resolution, and then resumes the async function's execution and evaluates as the resolved value.
Descripción La expresión await provoca que la ejecución de una función async sea pausada hasta que una Promise sea terminada o rechazada, y regresa a la ejecución de la función async después del término.
Contenu potentiellement sensible ou inapproprié
Les exemples vous aident à traduire le mot ou l’expression cherchés dans des contextes variés. Ils ne sont ni sélectionnés ni validés par nous et peuvent contenir des mots ou des idées inappropriés. Signalez des exemples à modifier ou à retirer. Les traductions potentiellement sensibles, inappropriées ou familières sont généralement marquées de rouge ou d’orange.