📅  最后修改于: 2022-03-11 15:03:57.788000             🧑  作者: Mango
// how to Fetch API to Get Data using async await and then catch in javascript
async function getFetchData(url){
await fetch(url)
.then(response => response.json())
.then(data => console.log(`Id: ${data[99].id}, Title: ${data[99].title}`))
.catch(error => console.log(error))
}
getFetchData(apiUrl);