Run a second function only after the first function is completely finished code example
Example: 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();