I have found this code on SO :
function dothings(things, ondone){
function go(i){
if (i >= things.length) {
ondone();
} else {
dothing(things[i], function(result){
return go(i+1);
});
}
}
go(0);
}
I couldn't figure out how I should define dothing
function. Should it be like this :
function dothing(elem)
{
//do things with elem
}
Or should I somehow indicate the function(result)
, if yes how should I do that? Thanks in advance.