Skip to content

Instantly share code, notes, and snippets.

@samueljoli
Created January 30, 2017 18:26
Show Gist options
  • Select an option

  • Save samueljoli/9a0bd54b8d207cc728f9fb19bacb91de to your computer and use it in GitHub Desktop.

Select an option

Save samueljoli/9a0bd54b8d207cc728f9fb19bacb91de to your computer and use it in GitHub Desktop.
var Async = require('async');
var numbers = [];
function test(){
for(var i=1; i <= 1000000; i++) {
numbers.push(i);
}
Async.map(numbers, function(num, callback) {
setTimeout(function() {
callback(Math.pow(num, 2));
}, 200);
}, function(err, result) {
console.log('done');
})
}
test();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment