javascript sleep function with changing parameters
<p>array moves contains just a couple of move I wanna draw on canvas. basically a deltaTime to sleep and a draw command.   </p>

<p>This simply doesn't work :(</p>

<pre><code>for (var i=0; i&lt; parsed.moves.length; i++)
{
    var e = parsed.moves[i];
    setTimeout(function(){drawCmd(context,e)}, e.deltaTime*1000);

    //deltaTime are values btn 0-1, the sleep time i need to set btw commands 

 }  


function drawCmd(canvasctx, e)
{   

switch(e.type)
{
   //case ...
}
 }
</code></pre>

<p>it did nothing at all, not even calling drawCmd function</p>
