Based on this library, https://github.com/caolan/async
I have a question. I have these following code:
var async = require('async');
var arr = [
1000000,
1000,
1
];
var loopNumAsync = function(item, doneLogAnItem) {
for (var i = 0; i < item; i++) { }
console.log(item);
doneLogAnItem();
};
var doneLog = function() {
console.log("all items have been processed successfully");
};
async.each(arr, loopNumAsync, doneLog);
async.eachSeries(arr, loopNumAsync, doneLog);
why does the result is the same? which is
1000000
1000
1
all items have been processed successfully
1000000
1000
1
all items have been processed successfully
as far as I know, async.each should be processed parallel? which means it should log 1, 1000 and 1000000 and not the other way around.
Anyone care to explain?