Answers for "javascript execute function after async"

0

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 */})
Posted by: Guest on September-10-2020

Code answers related to "javascript execute function after async"

Code answers related to "Javascript"

Browse Popular Code Answers by Language