title: Resolve Javascript Promise outside the Promise constructor scope
body: <p>I have been using ES6 Promise.</p>
  
  <p>Ordinarily, a Promise is constructed and used like this</p>
  
  <pre><code>new Promise(function(resolve, reject){
      if (someCondition){
          resolve();
      } else {
          reject();
      } 
  });
  </code></pre>
  
  <p>But I have been doing something like below to take the resolve outside for the sake of flexibility.</p>
  
  <pre><code>var outsideResolve;
  var outsideReject;
  new Promise(function(resolve, reject) { 
      outsideResolve = resolve; 
      outsideReject = reject; 
  });
  </code></pre>
  
  <p>And later</p>
  
  <pre><code>onClick = function(){
      outsideResolve();
  }
  </code></pre>
  
  <p>This works fine, but is there an easier way to do this? If not, is this a good practice? </p>