API REQUEST

 let url="https://catfact.ninja/fact";


fetch(url)
.then((res)=>{
    console.log(res);
return res.json();
})

.then((data1)=>{
    console.log(data1.fact);
    return fetch(url);
})
.then((res)=>{
    return res.json();
})
.then((data2)=>{
    console.log(data2.fact);
})
.catch((err)=>{
console.log(err);
})



Comments

Popular posts from this blog

Callback Hell

TODO list with DOM

Refactoring callback hell code