I am currently trying to get an array to display a different element in my HTML with javascript after each time a button is clicked. I am using a for loop to represent the item in the array. I am having a lot of trouble getting any content to show up in the html at all. I am pretty new to this all so any help would be appreciated.
const activityButton = document.getElementById("activityButton");
const activityBox = document.getElementById("activitiesBox");
for (let i = 0, i < activitiesArray.length, i++) {
activityButton.onclick = function(){
activityBox. innerHTML =
`
<p>ACTIVITY: ${activitiesArray[i].activity}</p>
<p>ENERGY NEEDED: ${activitiesArray[i].energy}</p>
<p>MONEY NEEDED: ${activitiesArray[i].money}</p>
`;
};
}
activitiesArray.lengthtimes a function to theonclickproperty of the same button (activityButton)for (let i = 0, i < activitiesArray.length, i++)to;