title: JS Function self-disable for a specific time after execution
body: <p>I'm trying to create a function which is executed by a keypress and disabled for a specific time after execution.</p>
  
  <pre><code>function do_something() {
      console.log('lorem ipsum');
  }
  
  document.onkeypress = function(e) {
    if (e.keyCode == '32') {
      do_something();
    }
  }
  </code></pre>
  
  <p>Is there any way to disable it for (let's say) 2 seconds after every execution?</p>