A Better setTimeout

If you’ve ever used JavaScript’s setTimeout and setInterval methods. you’ve probably found them just a bit … inadequate.

  • Both return an integer rather than an actual handle.
  • If you’re using both setTimeout and setInterval, you have to remember whether the integer value is a timeout or an interval in order to call the appropriate clearXXX method.

Continue reading