title: JS ES6 Promise Chaining
body: <p>I'm trying to learn how to use promises, but am having trouble comprehending the chaining. I assume that with this code, both promises will run. Then when I call test.then() it should know that test has resolved and pass the resolve data to then().</p>
  
  <p>Once that function finishes, it goes onto the next then(), repeating the same process with the test2 promise.</p>
  
  <p>However, I can only get it to print out the first promise results, not the second. Any ideas what is missing here?</p>
  
  <pre><code>var test = new Promise(function(resolve, reject){
      resolve('done1');
  });
  
  var test2 = new Promise(function(resolve, reject){
      resolve('done2');
  });
  
  test
  .then(function(data) {
      console.log(data);
  })
  .then(test2)
  .then(function(data) {
      console.log(data);
  });
  </code></pre>