I hit my head about JavaScript asynchronous behavior when scaling functions from my test data to production work.
Do I have a loop forthat, as I know, will range from hundreds of thousands, will Node pause the loop forand return to it, or can I safely assume that Node will execute the loop to complete before returning my function?
Here is the cycle in question:
function fixData(dataset, blockcount){
for (var i = 0, len = dataset.length; i < len; i++) {
var obj = dataset[i];
obj._id = obj.name;
obj.expires = blockcount + obj.expires_in;
delete obj.expires_in;
}
return dataset;
}
anon
source
share