<div>test</div>
 <div>test</div>
 <div>test</div>
If I have a list of divs and want the font size to increase to 20px when clicking each one, I know I can do the following:
let elements = document.querySelectorAll('div');
for (var x = 0; x < elements.length; x++) {
  elements[x].addEventListener('click', () => {event.target.style.fontSize = "20px"}
}
Is there a way to iterate through the listen and add an onclick rather than doing it with the addEventListener way instead?   Also, if there is, is one preferred over the other? 
 
     
     
    