title: How to initiate a setInterval function with 0 sec but repeat it for a given time?
body: <p>I'm currently using a <code>setInterval</code> function so that I can repeat text with an extra letter added to it for every 5 secs, hence I've set the time period for the <code>setInterval</code> function as 5000.</p>
  
  <p>But I also want this function to be executed as soon as the page loads. To be clear the logic present inside the <code>setInterval</code> function should be executed as soon as the page loads and it should also be repeated for every 5 secs. Is it possible with <code>setInterval</code> function or else is there any other way to do it? Thank you in advance :)</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>setInterval(function(){
    var x = document.getElementById('sample');
    x.innerHTML = x.innerHTML+'L';
    },5000);</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;p id="sample"&gt;Sample Text&lt;/p&gt;</code></pre>
  </div>
  </div>
  </p>