When using Javascript, Typescript or any other programming language, beware of asynchronous functions (the ones returning a Promise).
The code execution will become non-linear. If you don't pay attention, with the right timing the code may seem to work, but it will not always work (because it is not correct).
If you need to wait the completion of an async function before executing something, use await or put your code inside .then() and .catch().
We strongly encourage the use of async/await to improve the readability of the code.
#javascript #typescript #shorts #codingtips #asyncawait #programming #coding
Nesta página do site você pode assistir ao vídeo on-line Javascript Mistakes: Async Code with Promises. Just use Async/Await! duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário Th30z Code 12 Abril 2023, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 159 vezes e gostou 15 espectadores. Boa visualização!