title: variable scope in asynchronous function
body: <p>I've built the function to return some variable. But my function uses another function asynchronously.</p>
  
  <pre><code>function getVariable() {
    var myVariable;
    asyncronousFunction(function(...){
  
      myVariable = ...
  
    });
    return myVariable;
  }
  </code></pre>
  
  <p>The problem is that <code>myVariable</code> outside of and inside in <code>asyncronousFunction</code> are different variables. So I can't assign value to <code>myVariable</code> from asynchronous function.</p>
  
  <p>How to resolve this scope problem? Thanks.</p>