I want to know how parallel execution works in async.js
async = require('async')
async.parallel([
function(callback){
for (var i = 0; i < 1000000000; i++) /* Do nothing */;
console.log("function: 1")
},
function(callback){
console.log("function: 2")
}
]);
In the above example, I expect obtain the output:
function: 2
function: 1
but, the console throws the inverse, what is happening? thanks.
async
library doesn't make a task/function
asynchronous. It assumes the tasks are already asynchronous and simply helps you keep track of a group of them. And, neither of your tasks are asynchronous. – Skeptic