Function is :
[1,2,3].map( function (item)
{
  console.log(item);
  //return 'something';
});
My expected behaviour is getting only 1 as output, unless i uncomment the
//return 'something'
But i really get
1
2
3
What am i doing wrong ?
UPDATE:
i am testing that with nodejs.
i really dont understand.
var async = require("async");
[1,2,3].map( function (item)
{
      console.log(item);
      //return 'something';
}); 
async.map([1,2,3], function (item,callback)
    {
        console.log(item);
        //callback(null,true)
    }, function (err,result)
        {
            console.log(result);
        }
);
Both return the same
1
2
3
And i really would like to wait till i get a return or a callback till the next item is executed.
SOLVED
async.mapSeries([1,2,3], function (item,callback)
    {
        console.log(item);
        //callback(null,true)
    }, function (err,result)
        {
            console.log(result);
        }
);
is the way to do it.
 
     
    