title: return value after a promise
body: <p>I have a javascript function where I want to return the value that I get after the return method.
  Easier to see than explain</p>
  
  <pre><code>function getValue(file){
      var val;
      lookupValue(file).then(function(res){
         val = res.val;
      }
      return val;
  }
  </code></pre>
  
  <p>What is the best way to do this with a promise. As I understand it, the <code>return val</code> will return before the lookupValue has done it's then, but the I can't <code>return res.val</code> as that is only returning from the inner function. </p>