title: How to fix addEventListener that does not work?
body: <p>my code have two addEventListener() the first one is fine but the second one have a problem</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>let catNames = ['pew', 'haha', 'Tsh', 'bom', 'tok'];
  let catPhotos = document.querySelectorAll('li img');
  let catNamePlaces = document.querySelectorAll('li p');
  let area = document.getElementById('area');
  let targetName = document.querySelector('#area p');
  let targetImg = document.querySelector('#area img');
  let counterArea = document.querySelector('#area div');
  
  for (let i = 0; i &lt; catNames.length; i++) {
    catNamePlaces[i].textContent = catNames[i];
  }
  for (let catPhoto of catPhotos) {
    catPhoto.addEventListener('click', function() {
      targetImg.src = catPhoto.src;
    }, false);
  }
  let counter = 0;
  
  targetImg.addEventListener('click', (function(num) {
    num++;
    counterArea.innerHTML = num;
  })(counter));</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;ul class="container"&gt;
    &lt;li&gt;
      &lt;p&gt;&lt;/p&gt;&lt;img src="cat1.jpg" alt="cat"&gt;&lt;/li&gt;
    &lt;li&gt;
      &lt;p&gt;&lt;/p&gt;&lt;img src="cat2.jpg" alt="cat"&gt;&lt;/li&gt;
    &lt;li&gt;
      &lt;p&gt;&lt;/p&gt;&lt;img src="cat3.jpg" alt="cat"&gt;&lt;/li&gt;
    &lt;li&gt;
      &lt;p&gt;&lt;/p&gt;&lt;img src="cat4.jpg" alt="cat"&gt;&lt;/li&gt;
    &lt;li&gt;
      &lt;p&gt;&lt;/p&gt;&lt;img src="cat5.jpg" alt="cat"&gt;&lt;/li&gt;
  &lt;/ul&gt;
  &lt;div id="area"&gt;
    &lt;p&gt;&lt;/p&gt;
    &lt;img src="" alt="selectedCat"&gt;
    &lt;div id="counter"&gt;&lt;/div&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>I expect from the second addEventListener that it will start from 0 then add one every time will be clicked on the targetImg but what is every time start from 1 and do nothing when I chick on it.</p>