Hi guys,
Currently i am trying to understand about the API calls, i am fetching the data and i understand it will return as a promise and that promise contains the data and on that JSON-data i can use .json to convert into object or arrays or object.
But in the browser i can only see this [object Promise] , i am just trying to understand the way to show the actual description, as it shows here as Sunny
Thanks in advance
.
let x1 = document.getElementById('apicall')
async function abc(){
let apicall = await fetch('http://api.weatherstack.com/current?access_key=de129598ee099224e5736e25632c210c&query=New%20York')
console.log(apicall)
let apidata= await apicall.json()
console.log(apidata)
// console.log(apidata.key)
console.log(apidata.current.weather_icons[0])
return apidata.current.weather_descriptions[0];
}
let z1=abc()
x1.innerHTML=`<p>Weather: ${z1} </p>`