title: How to make same function execute different part of the code when called at different intervals
body: <p>Is this even possible to do? I want to use the same function at different intervals. How can I make the function run at 5000 and execute certain part of code within the function.</p>
  
  <p>here is an example to give an idea:</p>
  
  <pre><code> var moto = function(){
     // at 5000 run this part of code
     console.log("did stuff when called at 5000 time interval")
  
     // at 6000 run this part of code
     console.log("did stuff when called at 6000 time interval")
   }
  
   window.setInterval(moto, 5000)
   window.setInterval(moto, 6000)
  </code></pre>