skip to Main Content

Does Javascript’s Fetch catch errors?

I am learning JavaScript api project, fetch, then, catch . I coded along with a YouTube JavaScript api project. Every time I try it, 'catch' is not working. let searchBtn=document.getElementById("search-btn"); let countryInp=document.getElementById("country-inp"); searchBtn.addEventListener("click", ()=>{ let countryName=countryInp.value; let finalURL=`https://restcountries.com/v3.1/name/${countryName}?fullText=true`; console.log(finalURL); fetch(finalURL)…

VIEW QUESTION
Back To Top
Search