title: How do I make sure that a promise is resolved before proceeding to the next lines?
body: <p>Say I have the following:</p>
  
  <pre><code>var myFuncResult = null;                
  browser.executeScript( "return myFunc();").then( function(i){
      myFuncResult = i;
      // console.log([ "myFunc is: ", i]); this is fine
  });
  console.log([ "myFunc is: ", myFuncResult]);
  //do something about myFunctResult
  myFuncResult.doSomethingElse();
  </code></pre>
  
  <p>Now the outer console.log is logging null because it has executed before the promise got resolved. How do I prevent that? How do I make sure that the function I provided executes first before console.log? I need my myFuncResult to be initialized before proceeding to the remaining lines.</p>