feat(async-await): catch promise with then() NOT working
This commit is contained in:
parent
c291026248
commit
5a66948cb7
|
@ -1,4 +1,4 @@
|
|||
function fetchDataFromApi() {
|
||||
async function fetchDataFromApi() {
|
||||
console.log('fetchDataFromApi() start...');
|
||||
|
||||
fetch('https://v2.jokeapi.dev/joke/Programming?type=single')
|
||||
|
@ -8,5 +8,6 @@ function fetchDataFromApi() {
|
|||
console.log('fetchDataFromApi() done.');
|
||||
};
|
||||
|
||||
fetchDataFromApi()
|
||||
console.log('index: Finished fetching data.');
|
||||
fetchDataFromApi().then(() => {
|
||||
console.log('Finished fetching data');
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue