Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var async = require('async');
- sum = function(x, y) {
- return (x + y)
- }
- x = 2;
- y = 3;
- async.parallel([
- function(callback) {
- setTimeout(function() {
- result = sum(x, y);
- callback(null, result);
- }, 100);
- },
- function(callback) {
- result = sum(x, y);
- callback(null, result);
- }
- ],
- function(err, results) {
- console.log(results[0] + results[1]);
- }
- );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement