I m basically trying to first clear the form div by saying form.innerHTML = ''
. Then when i try to insert one by one the elements from an array back to the form div using forEach() on the array, it just sets the innerHTML to the last element from that array.
Here’s my javascript code :
form.innerHTML = '';
userCorrectAnswers.forEach(e => {
let cA = e.innerHTML;
form.innerHTML = cA;
})
Need to know how can i add all the elements from that array to the innerHTML of the form.