title: Nodejs promise not working as it should?
body: <p>I am using nodejs and the library Promises/A+ (Chose this one as it seems to be the most popular) <a href="https://www.npmjs.com/package/promise" rel="nofollow">https://www.npmjs.com/package/promise</a>. The problem I am facing is even though the async function is completing as it should, it is completing after the failure statement. So <code>sv + ' No it failed'</code> is always printed before a console.log message (which indicated it was successful) I have in the async method. This console.log message should be printed before as it is inside of the async method. I am stuck why this happening? The promise always runs as it failed even though the async method return as it has succeeded?</p>
  
  <p>My Code:</p>
  
  <pre><code> var promise = new Promise(function (resolve, reject) {
  
          var u = asyncmethod(some_var);
  
              if (u){
                  resolve(some_var)
              }
              else{
                  reject(some_var);
              }
      });
  
  
      promise.then(function(sv) {
          console.log(sv + ' Yes it worked');
      }, function(em) {
          console.log(sv + ' No it failed');
      });
  </code></pre>