I have script like this,
for (var i = 0; i < 10;i++){
axios.get(url).then(res=>{
console.log("product connection success",i);
}).catch(res=>{
console.log("product connection error",res);
});
}
Always i returns 10
, because this callback is called after i loop finished.
However I want to get the i
when axios.get is called.
Is it possible? or how can I passed the certain data to callback?