I know 2 will be console.logged first and then 1. Is there any way, maybe with callbacks, I can show 1 first and then 2?
function first(){
// Simulate a code delay
setTimeout( function(){
console.log(1);
}, 500 );
}
function second(){
console.log(2);
}
first();
second();
second()in timeoutfirstorsecond; just doconsole.log(1); console.log(2);.firstfunction