javascript - How to get the content of a paragraph? : I have 10 paragraphs, each displaying a number from 1 to 10. I need a function that when clicking on the paragraph, reads the description of it an stores it in an array. So far I managed to do this: 

function readValue(p)
{
    var text = document.getElementsByTagName('p')[0].innerHTML;
   
    console.log(textId);
}

But when I'm clicking on the 5th paragraph, it still logs "1" to console. How can it be changed to get the content of the paragraph that was actually clicked? Thank You!