I would like to call f2 after f1 has been completed. f1 function can be synchronous or asynchronous.
f2
f1
Just remove the timeout
function f1() { return new Promise((resolve, reject) => { console.log('i am first'); resolve(); }); } function f2() { console.log('i am second'); } f1().then(f2);