title: How to run number statements as sequence with javascript?
body: <p>I am trying to running some statements as sequence with javascript and wrote this codes but did not work.Please advice</p>
  
  <pre><code>    var repeat = true;
  
      var bootstrap = false;
      function fifteen() {
          document.getElementsByClassName("progress-bar")[0].setAttribute("style", "width:50%");
          //document.getElementsByClassName("progress-bar")[0].style.width = "width:50%";
  
      }
  
      function sixteen() {
          if ( bootstrap != true) {
              document.getElementsByClassName("progress-bar")[0].setAttribute("style", "width:70%");
  
          }
      }
  
      var i = 0;
      function onehundred() {
          if (bootstrap === true) {
              document.getElementsByClassName("progress-bar")[0].setAttribute("style", "width:100%");
              console.log(++i);
          }
      };
  
      function clear() {
          if (document.getElementsByClassName("progress-bar")[0].style.width === "100%") {
                  clearInterval(r1);
                  clearInterval(r2);
                  clearInterval(r3).done(function() {
                      document.getElementsByClassName("progress-bar")[0].style.display = "none";
                      document.getElementById("content").className = "";
                  });
  
              }
      }
      //repeet this work 
  
        var r1=  setInterval(function () { sixteen(); }, 100);
        var r2=  setInterval(function () { onehundred(); }, 100);
        var r3 = setInterval(function () { clear(); }, 100);
  </code></pre>
  
  <p>Error in console: </p>
  
  <blockquote>
    <p>Uncaught TypeError: Cannot read property 'done' of undefined</p>
  </blockquote>