Reputation: 303
I have two arrays: pts
and test
. I need to add objects from pts
to test
one by one, after adding new object from pts
to test
I need to run function mimicSvg
.
So I write:
var test=[{"X":"300","Y":"400"}];
for(var m=1;m<pts.length;m++){
var q = pts[m].X;
var e = pts[m].Y;
console.log(test);
test.push({"X":q,"Y":e});
alert(m);
setTimeout( "mimicSvg(test,1)",3000 );
}
as you can see I put console.log into this and I see that I get all objects from pts
to test
at once.
How I can add one by one object from pts
to test
and after each adding to run function mimicSvg()
;
Upvotes: 1
Views: 56
Reputation: 85573
Use interval timer like this:
setTimeout( "mimicSvg(test,1)",m*3000 );
Upvotes: 2