.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
Jochem7mo 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
siuuuOP7mo ago
oh
Jochem
Jochem7mo ago
so fetch().then().catch(); or
fetch()
.then()
.catch();
fetch()
.then()
.catch();
siuuu
siuuuOP7mo ago
thanks buddy
Want results from more Discord servers?
Add your server