How to pass values to a callback function at the time of the request call?

后端 未结 3 1151
执念已碎
执念已碎 2021-01-07 08:32

I have the following situation:

var foo = [ 0, 1, 2 ]
for (var i in foo) {
    Asyncstuff.get(URI).on(\'response\', function(res) { console.log(i); } });
}
<         


        
3条回答
  •  轮回少年
    2021-01-07 09:01

    Using recursive pattern loop with node.js

    please refer my answer , am sure you can use this to solve your problem as you have the control over for loop

提交回复
热议问题