Answers for "Run a second function only after the first function is completely finished"

0

Run a second function only after the first function is completely finished

function run2functions() {
    firstFunc(secondFunc);
}

function firstFunc(cb) {
    setTimeout(() => {
    },1000);
    cb();
    console.log("first one");
}

function secondFunc() {
    setTimeout(() => {
        console.log("second one");
    },1000);
}
 
run2functions();
Posted by: Guest on April-19-2021

Code answers related to "Run a second function only after the first function is completely finished"

Browse Popular Code Answers by Language