javascript - Passing arguments to async.parallel in node.js -


I am trying to create a minimum example where I can complete as mentioned above. For this purpose, I have a minimum example, where I finally want to see the output

1 negative -1 -1

plus 3 of a 2

This is my code.

  var async = require ('async'); Var i, args = [1, 2]; Var name = ["negative", "plus one"]; Var funcArray = [Job negative (number, callback) {var neg = 0 - number; Console.log ("+ +" "Negative" + "+"); Callback (empty, negative); }, Function plusone (number, callback) {setTimeout (function (number, callback) is {var onemore = number + 1 console.log ("+ + +" + "+ +" on "+ +"); callback (Empty, onmore);}, 3000); }]; Var funcCalls = {}; For (i = 0; i  

Note that I am passing a named object async.parallel too. Passing an array (and completely forgetting about names) will also serve as an answer for me, but I am more interested in crossing such a thing.

Any ideas on achieving my goal?

Why not bound for initial values? Then you can do something like this:

  async.parallel ([negative.bind (null, -1), plusone.bind (tap, 3)], function (mistake, ridge) { Console.log (err, res);});  

Of course you can generate the list with different parameters. It was to give an idea of ​​a simplified approach.


Comments

Popular posts from this blog

winforms - C# Form - Property Change -

java - Messages from .properties file do not display UTF-8 characters -

javascript - amcharts makechart not working -