Creating elements from an array in JavaScript

Let's have some array:

javascriptlet arr = [1, 2, 3, 4, 5];

Let also we have some parent element:

html<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:

javascriptlet 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);
}
Задание 1

Modify my code so that when you click on a paragraph, one is added to its content.