how to resolve promise after value is returned\ code example
Example: immediate promise resolve
Promise.resolve().then(() => {
console.log('resolved');
});
console.log('end');
// end
// resolve
Promise.resolve().then(() => {
console.log('resolved');
});
console.log('end');
// end
// resolve