I have the below code which check for each user in an array. If found, the switch case will work accordingly.
var users = ["A","B"];
function searchUser() {
for (var j = 0; j < users.length; j++) {
execute(users[j]);
}
}
function execute() {
switch (selectUser) {
case "A":
{
return new A();
break;
}
case "B":
{
return new B();
break;
}
............
}
}
How can I make it run parallel. Now Im getting the output of A() and then B(). But I want it to happen vice versa also.