Skip to content
Advertisement

How do I iterate the array, then show all the elements in HTML? [closed]

I’m learning javascript, I try my best to use correct “word” to describe my question 🙂 This is my code, now it could only show the last item of the array to HTML, I thought forEach should iterate the while array to get all elements populate to HTML… anyone could give me some suggestion?

JavaScript
JavaScript

Advertisement

Answer

As @Rocky Sims said in comments change .innerHTML = to .innerHTML +=

JavaScript
JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement