feat(async-await): wrap calling code into a function

This commit is contained in:
dancingCycle 2023-12-04 14:44:00 +01:00
parent 93d9cd87a1
commit f3f29bdc5a
1 changed files with 6 additions and 3 deletions

View File

@ -8,6 +8,9 @@ async function fetchDataFromApi() {
console.log('fetchDataFromApi() done.');
};
fetchDataFromApi().then(() => {
console.log('Finished fetching data');
});
async function init() {
await fetchDataFromApi();
console.log('Finished fetching data');
}
init();