I have an array I have generated and I want to display it in html as a vertical list, preferably as each individual element.
I have done this:
var a = _.intersection(viewedUserLikedUsersArray, loggedInLikedUsersArray);
for (var i=0; i < a.length; i++){
displayListOfMatches.innerHTML = a[i];
}
but obviously this way will replace the innerHTML with the last element in the array rather than stacking each one on top of each other
displayListOfMatches.innerHTML += "<p>" + a[i] + "</p>";+=withinnerHTMLis a bad idea.displayListOfMatches.innerHTML = a.join("<br>");would be one way; no loop