title: SetTimeout javascript countdown Timer with delay
body: <p>hi i am confused with the below code</p>
  <p>JSfiddle <a href="http://jsfiddle.net/KJTjc/" rel="nofollow noreferrer">link</a></p>
  <pre><code>for (var i=6;i&gt;=0;i--)
      {
         
          setTimeout((function(i)
                {
                    
              $(&quot;div&quot;).delay(4000).html(i);
              alert(i); //if commented unable to see the countdown
              
                })
              (i),4000);
          //alert(1);
          
      }
          
  </code></pre>
  <p>I am not able to get the count down timer.. whats wrong.. when &quot;alert&quot; is commented unable to see the count down numbers.
  Please somebody explain how the above code works.. Post some correct code</p>