I want to execute a series of functions in order and at 1-second interval, and I write 2 functions main1 and main2 to do this:
function main1()
{
    for (var i = 0; i < 3; i ++)
    {
        eval("myFunc_" + i + "()");
        myPause(1000);
    }
}
function myPause(x)
{
  var start = new Date().getTime();
  for (var j = start; j < start + x; j = new Date().getTime())
  {
    ;
  }
}
function main2()
{
    for (var i = 0; i < 3; i ++)
    {
        setTimeout("myFunc_" + i + "()", i * 1000);
    }
}
I write a pause function myPause for main1 and I think these 2 functions are doing the same thing, but the function main1 doesn't work well. What's the problem of the function main1?