how to force an async function to run after another async function code example
Example: javascript execute function after async
function a() {
return new Promise(function(resolve) {
setTimeout(function() {
console.log('a');
resolve();
}, 500)
});
}
function b() {
return new Promise(function(resolve) {
setTimeout(function() {
console.log('b');
resolve();
}, 250);
});
}
a().then(b).then(function() {/* do something else */})