I met a problem in JS async function. Here is the sample code:
switch (name) {
case "0":
async_function(1, function() {
});
return;
case "1":
console.log("1");
return;
}
doSomething();
As you can see, if case "0" run, it is probably code will return before async_function. That is not what I want. Is there any good way to deal with this problem? Thanks!