title: Calling function with setTimeout in rapid fashion
body: <p>I want the backgroundColor of a div to change for 250ms, and then change back. for this I use the following code as onclick on the div:</p>
  
  <pre><code>function keyAnimation(key) {
  basicColor = key.style.backgroundColor;
  key.style.backgroundColor = "red";
  setTimeout(function () {
      key.style.backgroundColor = basicColor;
  }, 250);
  </code></pre>
  
  <p>But when I click the div multiple times quickly (within the 250ms) it remains red. 
  How can I code this so it will always go back to the basicColor after 250ms?</p>