title: removing event listener inside for loop javascript
body: <p>I'm trying to remove the event listener that I've added to my <code>UL</code>; so that the listener function will only fire on the first click and will be cleared after that.</p>
  
  <p>Is there a way to do this with pure js?</p>
  
  <pre><code> var cardDeck = document.getElementById('listDeck').getElementsByTagName('li')
  
      for (var i = 0; i &lt; cardDeck.length; i++) {
        cardDeck[i].addEventListener('click', flip, false)
      }
  
      function flip(e) {
        if (e.target &amp;&amp; e.target.nodeName == "LI") {
        var firstMove = document.getElementById(e.target.id)
        firstMove.classList.add('open', 'show')
          console.log(e.target.id + 'card was clicked');
        }
      }
  </code></pre>