Javascript: clearTimeout seems to only suspend, not reset or clear?
<p>I am very new to JS and am trying to modify the JavascriptKit jQuery-based megamenu system to delay showing the menu until the mouse has been hovering over the anchor object for a specified time.</p>

<p>The problem I am facing right now is that it seems that the clearTimeout that is called on mouseout only suspends the setTimeout, rather than canceling, clearing, resetting it. </p>

<p>At this point I am just showing an alert after a setTimeout call. Currently I have the timeout interval set to 2000 for testing.</p>

<p>As an example, since I have it set to 2 seconds delay right now, if I mouse over the object 4 times for 1/2 second, the 5th time I mouse over the object my test alert box appears instantly.</p>

<p>I thought clearTimeout was supposed to completely destroy the timed event. Why does it appear to only pause the countdown?</p>

<pre><code>teststuff:function(){
    if(jkmegamenu.toggletest==1)
     {
         jkmegamenu.executetimedcommand()
         jkmegamenu.toggletest=0
     }
    else
     {
         //jkmegamenu.executetimedcommandcancel()
         clearTimeout(jkmegamenu.teststuff);
     }
    },

    executetimedcommand:function(){
        if(jkmegamenu.toggletest==1)
        {
            alert('abcde')
        }
    },

    canceltimedcommand:function(){
    clearTimeout(jkmegamenu.teststuff);
},
</code></pre>
