title: Javascript Wait for function to complete the call another inside function
body: <p>below is my function I am using "setTimeout(function()" for delay how can I wait the above function to complete and then execute the other function.</p>
  
  <pre><code>function first_letter() {
    var myArray = ["A", "D", "E", "F", "G", "H", "K", "M", "N", "O", "P", "R", "S", "T"];
    var letter = myArray[Math.floor(Math.random() * myArray.length)];
    bg_width = xx;
    bg_height = xx;
  
    load(xx, xx)
    loading()
    make(xxxxxxx)
  
    setTimeout(function() {
      fillText(xxxxxx)
    }, 1500);
  
    setTimeout(function() {
      rounded(xxx)
    }, 2000);
  }
  </code></pre>
  
  <p>Like in given code. Wait until load(xx,xx) completes then executes make(xxxx).</p>