title: How to resolve JS promise from a outside function?
body: <p>I have a JS promise with a asynchronous function inside of it. How can I resolve or reject the function from inside the asynchronous function? Here is an example code...</p>
  
  <pre><code>    let promise = new Promise(function (resolve, reject) {
  
          asynchronousFunction();
  
        }).then(function (response) {
          //...
        });
  
     function asynchronousFunction() {
  
      //mimic asynchronous action...
      setTimeout(function(){
       resolve()
      },1000)
  
    }
  </code></pre>