title: Is it possible to run SetTimeout function sequentially?
body: <p>I'm trying to make a function which takes multiple functions as parameters and execute these functions sequentially, but each function has <code>setTimeout</code> by which make function execution in parallel. Is it possible to make it sequential?</p>
  
  <pre><code>  var fun1=function(){
      console.log('Started fun1');
      setTimeout(()=&gt;{console.log('Finished fun1');},2000)
  }
  
  var fun2=function(){
      console.log('Started fun2');
      setTimeout(()=&gt;{console.log('Finished fun2');},2000)
  }
  
  
  function fun3(arr){
    for(var i=0;i&lt;arr.length;i++)
      arr[i]();
  }
  
  fun3([fun1,fun2]);
  </code></pre>