title: javascript function wait until another function to finish
body: <p>I have two javascript functions that are called from android. After long debug sessions finally I realized that the problem is arising from the fact that second function is getting called before first one is finished. I already searched the examples with deferred etc, but they all depends on function calls within another one. </p>
  
  <pre><code>function FunctInit(someVarible){ //someVariable is sent from android, cannot call again from getResult
  //init and fill screen
  }
  
  function getResult(){ //also getResult need to be called from android via button
  //return some variables
  }
  </code></pre>
  
  <p>How can I force getResult to wait FuncInit? Is there a way to achieve this via Javascript?</p>