async.js each get index in iterator

后端 未结 6 1694
一整个雨季
一整个雨季 2021-02-02 07:04

I\'m using caolan\'s async.js library, specifically the .each method.

How do you get access to the index in the iterator?

async.each(ary, function(elemen         


        
6条回答
  •  佛祖请我去吃肉
    2021-02-02 07:41

    Just use async.forEachOf().

    async.forEachOf(arr, function(value, index, callback) { ... }, ...
    

    For detail, see documentation here.

提交回复
热议问题