title: How to return the last value in Q javascript
body: <p>Hi there im new to writing promises in javascript. I want to return a value from func1 which are composed of then (using q) calling other functions resolving the value then passing to through the next function. The problem is i want to return the last value in func 1. So I can use it in caller function. But init value just returns undefined. 
  Here are the codes:</p>
  
  <pre class="lang-js prettyprint-override"><code>function func1(string1, string2) {
    othermodule
      .otherfunc1(string1)
      .then(function(outputstring1) {
        var params = othermodule.otherfunc2(outputstring1,string2);
        return params;
      })
      .then(anotherfunc)
      .then(anotherfunc2)
      .then(function (data) {
         console.log(data);
         // outputs data
         return data;
      });
  }
  
  function caller() {
    var initValue = 0;
    initValue = func1(string1,string2);
    console.log('init value = '+initValue);
    //init value = undefined
  }
  </code></pre>