Let's have some array:
let arr = [1, 2, 3, 4, 5];
Let also we have some parent element:
<div id="parent"></div>
Let's add new paragraphs to our parent, the text of which will be the elements of our array.
Implementing the described:
let parent = document.querySelector('#parent');
let arr = [1, 2, 3, 4, 5];
for (let elem of arr) {
let p = document.createElement('p');
p.textContent = elem;
parent.appendChild(p);
}
Modify my code so that when you click on a paragraph, one is added to its content.