I'm facing async call problem in javascript with wrong (not the expected) value being passed to the function. See pseudocode:
i=0;
while(i<10){
var obj= {something, i};
getcontent(obj); //( <--- getcontent is async function/problem)
i++;
}
All getcontent async calls use the last i = 9 value, which is not what i want to achieve.
How do/should i process such async calls and get correct/pass correct i values in every call??