.this() and .catch()

fetch("https://pokeapi.co/api/v2/pokemon/pikachu");// to fetch third party API's .then((data)=>console.log(data)); .catch((error)=>console.error(error)); so in vs code .then() or .catch() methods says . is unexpected token
4 Replies
Jochem
Jochem8mo ago
those are chained off the first one, you can't use a semi-colon after fetch or then if you want to call another method on the result
siuuu
siuuuOP8mo ago
oh
Jochem
Jochem8mo ago
so fetch().then().catch(); or
fetch()
.then()
.catch();
fetch()
.then()
.catch();
siuuu
siuuuOP8mo ago
thanks buddy
Want results from more Discord servers?
Add your server