I need to do the code like following:
function taskFirst(k, v) { console.log(k, v); } function taskSecond(k, v) { console.log(k, v); } function run() {
This answer to async's github issue has worked for me perfectly. https://github.com/caolan/async/issues/241#issuecomment-14013467
for you it would be something like:
var taskFirst = function (k, v) { return function(callback){ console.log(k, v); callback(); } };