0
Please why no output
Please what could be wrong with my code..I get a blank page when I try to output. https://code.sololearn.com/W3Ytp1zYpf4F/?ref=app
5 Respostas
+ 3
function getData(){
  fetch("https://www.boredapi.com/api/activity")
  .then((respobj)=>respobj.json())
  .then((data)=>{
		var show=`<h1>Activities</h1>`
     show+=`
     <div>
     <h2>${data.activity}</h2>
     <p>${data.type}</p>
     </div>
     `
 stuff.innerHTML=show
 })
}
getData()
+ 2
It all depends on how the database is formed.
+ 1
Because "data" is not an iterable object, it does not have a "forEach" function.
0
Ok Solo ..But why did you take out the forEach
0
I get your point @solo ..it appears a post at a time.But checkout this other code.it fetches multiple posts at once
https://code.sololearn.com/WCFQ4RkwZScC/?ref=app



