I need to write a function in JavaScript, which returns a state from calling an asynchronous function. However, the caller only receives the value and no callback function i
Why not just:
asyncCall("request", function() { // here you can inspect the state });
What's the point of the wrapper function?
Asynchronous functions work this way. If you want to block the execution, then use a synchronous call:
var state = syncCall("request");