jQuery/Javascript Random Number Animation
<p>I'm trying to make an animation where 6 numbers are generated one after another. However I'm having problems with it. I'm using the code from here
<a href="http://jsfiddle.net/ZDsMa/1/" rel="nofollow">http://jsfiddle.net/ZDsMa/1/</a></p>

<p>However I can't seem to get it to pause the loop. This is my code.</p>

<pre><code>var numbers = [12,54,32,45,21,69,20];
for (var i = 0; i &lt; (numbers.length + 1); i++) {
    var duration = 2000;
    var desired = numbers[i];

    output = $('#' + i);
    started = new Date().getTime();

    animationTimer = setInterval(function() {
        if (output.text().trim() === desired || new Date().getTime() - started &gt; duration) {

        } else {
            output.text(
                '' +
                Math.floor(Math.random() * 10) +
                Math.floor(Math.random() * 10)
            );
        }
    }, 100);
}
</code></pre>

<p>So what I'm trying to do is generate 12 like the above example, wait for it to complete then generate 54 etc... I'm really struggling with this though... Would love some help :)</p>