I have an array of function with async method inside it.I want to create a function which takes the array of function and execute the function in sequential order.I am not sure how to achieve it.Thanks for help.The functions are not async in nature.Its the method inside each functions
Example.
function task1() {
console.log('task1:started');
setTimeout(function() {
console.log('task1:finished');
}, 5000);
}
function task2() {
console.log('task2:started');
setTimeout(function() {
console.log('task2:finished');
}, 5000);
}
function runner(tasks) {
// help with implementation needed
console.log('Desired Output:');
console.log('task1: started');
console.log('task1: finished');
console.log('task2: started');
console.log('task2: finished');
}