r/code • • Mar 11 '24

Javascript question about fetch

In the example we are fetching Pokémon from the pokeAPI

why does he add a if statement if he already has a catch and why do we use await here

3 Upvotes

7 comments sorted by

View all comments

Show parent comment

1

u/OsamuMidoriya Mar 14 '24

I rewatch the video and i made a mistake, I look at the screen shoot to write my question. I didn't want to know about await, i wanted to know why .then is used with fetch not in { }. i know .then does something after a function is called