I have a function
function getData(foo) {
return axios.get(url+foo)
.then(response => response.baz)
.catch(error => console.log(error))
}
Somewhere else in my code I call it.
function baz() {
//....
document.getElementById('bar').textContent = getData()
//....
}
But then I end up with the text of [object Promise]
inside my element.
Why does this happen and how can I make sure only the true value gets inserted without using async/await?