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...
let promise = new Promise(function (resolve, reject) {
asynchronousFunction();
}).then(function (response) {
//...
});
function asynchronousFunction() {
//mimic asynchronous action...
setTimeout(function(){
resolve()
},1000)
}