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
Sur cette page du site, vous pouvez voir la vidéo en ligne Javascript Mistakes: Async Code with Promises. Just use Async/Await! durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Th30z Code 12 avril 2023, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 159 fois et il a aimé 15 téléspectateurs. Bon visionnage!