resolve promise only when fonction is finished 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