async.js each get index in iterator

You can use async.forEachOf – it calls its iterator callback with the index as its second argument. > async.forEachOf([‘a’, ‘b’, ‘c’], function () {console.log(arguments)}); { ‘0’: ‘a’, ‘1’: 0, ‘2’: [Function] } { ‘0’: ‘b’, ‘1’: 1, ‘2’: [Function] } { ‘0’: ‘c’, ‘1’: 2, ‘2’: [Function] } see the docs for more info.

Node.js – Using the async lib – async.foreach with object

The final function does not get called because async.forEach requires that you call the callback function for every element. Use something like this: async.forEach(Object.keys(dataObj), function (item, callback){ console.log(item); // print the key // tell async that that particular element of the iterator is done callback(); }, function(err) { console.log(‘iterating done’); });

What is the difference between async.waterfall and async.series

It appears that async.waterfall allows each function to pass its results on to the next function, while async.series passes all results to the final callback. At a higher level, async.waterfall would be for a data pipeline (“given 2, multiply it by 3, add 2, and divide by 17”), while async.series would be for discrete tasks … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)