.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
Jochem2mo 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
siuuu2mo ago
oh
Jochem
Jochem2mo ago
so fetch().then().catch(); or
fetch()
.then()
.catch();
fetch()
.then()
.catch();
siuuu
siuuu2mo ago
thanks buddy