title: How to set a delay before a listener event is triggered for the second time
body: <p>I'm testing some code to check if input includes a string. It works fine however when I type rapidly it get's triggered twice! Can someone explain why and how I can fix it?</p>
  <pre class="lang-js prettyprint-override"><code>
  var inputSelector = document.querySelector('input[name=&quot;category&quot;]');
  
  inputSelector.addEventListener('keyup', function(){
      var inputNaam = inputSelector.value;
      inputNaam.toLowerCase();
      if(inputNaam.length === 9 &amp;&amp; inputNaam.includes('baardzorg')){
              console.log('match')
      }
  })
  </code></pre>
  <p>I think this happens because if I type rapidly I will release the two last keys after I finished typing 'baardzorg'. How can I prevent this from happening?</p>