async.map won't call callback in nodejs

Viewed 8097

I am trying to use async.map but can't get it to call the callback for some unknwon reason in the below example, the function d should display the array r but it just does not. actually it is as if d was never called.

I must be doing something really wrong but can't figure out what

async = require('async');
a= [ 1,2,3,4,5];
r=new Array();

function f(callback){
    return function(e){
        e++;
        callback(e);} 
}

function c(data){ r.push(data); }

function d(r){ console.log(r);}

async.map(a,f(c),d);

thank you in advance for your help

1 Answers
Related