title: Issue with promise: ReferenceError: reject is not defined
body: <p>I am working with some own built promise examples to understand how this function is working.</p>
  
  <p>That following code produces the error </p>
  
  <blockquote>
    <p>ReferenceError: reject is not defined</p>
  </blockquote>
  
  <p>I start this with node Promise.js and use node version 8.11.3</p>
  
  <p>Here is my code, the part which produces the error is commented with "problem</p>
  
  <pre><code>function testPromise () {
  
  //part 1
    function checkCountOnServer () {
      return new Promise(function (resolve, reject) {
        var available = false
        if (available) {
          resolve('available')
        }
        else {
          reject('not available')
        }
      })
    }
  
    function checkPayment () {
      return new Promise(function (resolve, reject) {
        var booleanTest = true
        if (booleanTest) {
          resolve('payment done')
        }
        else {
          reject('no payment received')
        }
      })
    }
  
    var checkCountOnServerVar = checkCountOnServer()
    checkCountOnServerVar.then(function (resolve) {
      console.log(resolve)
      return resolve(checkPayment())
    }, function (reason) {
      console.log(reason) //works
      reject(reason) // problem
    }).then(function (value) { console.log(value) },
      function (rejected) {
        console.log(rejected) //problem
      })
  
  }
  
  testPromise()
  </code></pre>
  
  <p>I actually expect the message 'not available' two times. </p>
  
  <p>Even if I change reject(reason) to reject('test') I get the same error.</p>
  
  <p>Help me please.</p>