Javascript - if with asynchronous case
问题 My question is a bit regards concept. A lot of times there is this such situation: if(something){ someAsyncAction(); }else{ someSyncAction(); } // Continue with the rest of code.. var a = 5; The problem with this such case is clear, i don\'t want the var a = 5 to be call unless someAsyncAction() or someSyncAction() will done, now, cause soAsyncAction() is asynchronous the only way (i can think of) to solve this situation is something like that: var after = function(){ // Continue with the