Here is my code, I want to run the loop until i<2*(actors.length-1)
async function drawArrows(actors, timeout, drawArrow, i = 0) {
drawArrow(i, timeout, actors.length-1);
for(const actor of actors){
new Promise(function(resolve, reject){
setTimeout (() => {
resolve(drawArrows(actor,timeout,drawArrow, ++i));
},timeout) ;
});
};
};
Where should this i<2*(actors.length-1)
be fit for terminating this loop?