由于您正在遍历数组,因此可以简单地使用
forEach其中提供的列表项和回调中的索引。迭代将具有自己的范围。
list.forEach(function(listItem, index){ mc_cli.get(listItem, function(err, response) { do_something(index); });});
由于您正在遍历数组,因此可以简单地使用
forEach其中提供的列表项和回调中的索引。迭代将具有自己的范围。
list.forEach(function(listItem, index){ mc_cli.get(listItem, function(err, response) { do_something(index); });});