title: how to execute a for loop with delay in javascript
body: <p>Hi I was just wondering how I can execute a for loop with delays</p>
  
  <pre><code>var currentPosition2 = 1;
      for(i=0;i&lt;numberOfSlides;i++) {
          //alert(currentPosition2);
          currentPosition2 = currentPosition2 + 1;
          jQuery('#slideInner').animate({
              'marginLeft' : slideWidth*(-currentPosition2)
          });             
      }
  </code></pre>
  
  <p>at the moment all 3 slides animate at one time, I'd like to make a delay of 3 seconds between each loop and 3 seconds before the loop starts, </p>
  
  <p>any help would be appreciated,</p>
  
  <p>thanks</p>