Created
February 20, 2019 14:55
-
-
Save questsin/890c2c47ef8d7b9dc0d9016828b1a02b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const async = require('async'); | |
var items = [1,2,3,4,5,6,7,8,10]; | |
function callback(){ | |
console.log("done"); | |
} | |
// 1st para in async.each() is the array of items | |
async.each(items, | |
// 2nd param is the function that each item is passed to | |
function(item, callback){ | |
console.log(item); | |
callback(); | |
}, | |
// 3rd param is the function to call when everything's done | |
function(err){ | |
// All tasks are done now | |
console.log("done"); | |
} | |
); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment