Suppose I have a code like this:
console.log(1);
console.log(2);
setTimeout(() => console.log("Callback fired"),2000);
console.log(3);
console.log(4);
What I wanted to have was logging 1 and 2 in console and then waiting for 2 seconds to log "Callback fired" and then carry on.
I did try using promise but that didn't worked either or perhaps I did it wrong