title: Call JavaScript function after 1 second One Time
body: <p>I have successfully managed to make a div hide on click after 400 milliseconds using a setInterval function. My issue is that it runs continually, I only need the function to execute once. After a quick search I discovered that the setInterval can be stopped by clearInterval. Am I using this incorrectly? The closeAnimation function is being executed on click. I modelled my code after the code on this page: <a href="http://www.w3schools.com/jsref/met_win_setinterval.asp" rel="noreferrer">http://www.w3schools.com/jsref/met_win_setinterval.asp</a></p>
  
  <pre><code>function closeAnimation() {
      setInterval(function(){hide()}, 400);
      clearInterval(stopAnimation);
  }
  
  var stopAnimation = setInterval({hide()}, 400); 
  </code></pre>