I rewrote my code using fetch
instead of using callbacks, now the page is letting me loop through the API data. Even though I can see the data being fetched from the API in the console, when I use console.log.
Now I am getting this error message
Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'length')
at scripting.js:30:40
runCode.addEventListener("click", ()=>{
fetch(theUrl)
.then(response=>{response.json()})
.then((data)=>{
for(let i=0;i<data.length; i++){
generateHTML(data[i]);
}
})
});