//feth method
// - take the url as parameter
// - return a promise
// - pass response when resolved
// - pass error when rejected
// - the response has the http response information
// - use the .json() is used to get the body of the response
// - .json return a promise
// - resolve the promise with data as the argument
fetch("test.json")
.then(response =>{
return response.json();
}).then(data=>{
document.body.innerHTML = data.name;
console.log(data)
}).catch(error =>{
console.error(error)
})