Speed up development with full-stack environments for every branch.

Learn More

node async.map example [Node.js]

Forked from async map example.

2155 Runs 8774 Views 1945 Copies
Saved

Saved

michaelherman 1

michaelherman
published 3 years ago

    var async = require('async');
    
    var names = ["michael","richard","john","jennifer","ben","julie"];
    async.map(names, getInfo, function (err, result) {
      if(!err) {
        console.log('Finished: ' + result);
      } else {
        console.log('Error: ' + err);
      }
    
    });
    
    function getInfo(name, callback) {
      setTimeout(function() {
        callback(null, name.toUpperCase());
      }, 1000);
    }
    Please login/signup to get access to the terminal.

    Your session has timed out.

    Dismiss (the page may not function properly).