promise

function a(){
        console.log('A');
}
function b(){
    console.log('B');
}
a();
b();

//A
//B
function a(){
    setTimeout(function(){
        console.log('A');
    },1000);
}
function b(){
    console.log('B');
}
a();
b();

//B
//A

Last updated

Was this helpful?