title: Reset setTimeout after timer expires
body: <p>I have an ongoing while loop. In the while loop, there is a <code>setTimeout()</code>. I want to reset the timer AFTER the timer expires. In other words, when timer expires, it should do some specified actions, and then freshly start the timer again. </p>
  
  <p>For example, in the following code, <code>%%--Hi--%%</code> should be printed only ONCE in 5 seconds. However, after 5 seconds, <code>%%--Hi--%%</code> is printed continuously. I tried <code>clearTimeout</code> but it looks like that clearTimeout can stop timer only before timer expires.</p>
  
  <pre><code>while(){
      var timeoutHandle = setTimeout(function() {
                          console.log("%%--Hi--%%");
                          clearTimeout(timeoutHandle);
                          }, 
                          5000); //5 sec
  }
  </code></pre>
  
  <p>Help please! Thanks!</p>