title: javascript animation: do I need nested setInterval?
body: <p>I'm reformulating my question you can found here:
  <a href="https://stackoverflow.com/questions/9107758/javascript-nested-loops">Javascript: nested loops?</a>
  because I believe I wasn't clear and the solutions didn't nail my problem.
  let me try to make ti more clear:</p>
  
  <p>Assuming I have an animation <code>animation(n)</code> that is a function that randomly delete the first letter of every word in a a web page (i know is weird but is just an example for the question's sake), and I want the user to see letters disappearing with a random timing (a sequence of animations, variable speed and pauses)</p>
  
  <p>assuming</p>
  
  <pre><code>function animation(n){
  
  // n is the numer of letters to remove
  // code to remove the letter
  
  }
  </code></pre>
  
  <p>how do i trigger this animation() every 2 seconds, and the animation should last 0.5sec ?</p>
  
  <p>or random approach:</p>
  
  <p>how do i trigger this animation() every n (n>0 &amp;&amp; n&lt;2) seconds, and the animation should last n (n>0 &amp;&amp; n&lt;2) seconds ?</p>
  
  <p>I've been trying using setInterval but I'm kinda lot now</p>