
/* Implement the function asyncMap:
 *
 * asyncMap has two parameters, an array of asynchronous functions (tasks) and a callback.
 * Each of the tasks takes a separate callback and invokes that callback when complete.
 *
 * The callback passed to asyncMap is then performed on the results of the callbacks of the tasks.
 *
 * The order of these results should be the same as the order of the tasks.
 * It is important to note that this is not the order in which the tasks return,
 * but the order in which they are passed to asyncMap.
 *
 * Once all the callbacks of the tasks are returned, asyncMap should invoke the callback
 * on the results array.
 *
 *
 * Example:
 *
 * asyncMap([
 *  function(cb){
 *    setTimeout(function(){
 *      cb('one');
 *    }, 200);
 *  },
 *  function(cb){
 *    setTimeout(function(){
 *      cb('two');
 *    }, 100);
 *  }
 * ],
 *  function(results){
 *    // the results array will equal ['one','two'] even though
 *    // the second function had a shorter timeout.
 *    console.log(results); // ['one', 'two']
 * });
 *
 *
 */

@@ -1064,8 +1064,565 @@
 %0A *%0A */%0A
+ var tasks = %5B%0A    function cbOne()%7B%0A      setTimeout(function()%7B%0A         console.log('one')%0A        %7D, 300);%0A    %7D.%0A    function cbTwo()%7B%0A      setTimeout(function()%7B%0A         console.log('Two')%0A        %7D, 200);%0A    %7D,%0A    function cbThree()%7B%0A      setTimeout(function()%7B%0A         console.log('Three')%0A        %7D, 100);%0A    %7D%0A  %5D%0A%0A// var asyncMap = function( tasks, callback )%7B%0A//   var results = %5B%5D;%0A%0A//   for( var i = 0; i %3C tasks.length; i++ )%7B%0A//     results.push( callback( tasks%5Bi%5D ) )();%0A//   %7D%0A%0A// %7D;%0Avar asyncMap = function(tasks, callback)%7B%0A%0A%0A%7D;%0A

edit solution