Hacker Timesnew | past | comments | ask | show | jobs | submitlogin
JavaScript and Asynchronous Functions (vivaldi.net)
1 point by freedude on Aug 15, 2023 | hide | past | favorite | 1 comment


"A Promise is a proxy for a value that is not necessarily known when the promise is created. It allows us to associate handlers with an asynchronous action’s eventual success value or failure reason. Here, in the first part of the code, the Promise allows us to actually make a promise that after a second (after the fetch function is fully completed), we can resolve the “html” variable, which allows us to return the variable inside of the Promise to the executor function on the second part."




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: