title: In JavaScript how to add delay in loop
body: <p>In JavaScript how can i add delay to JavaScript loop
  In this below code</p>
  
  <pre><code>snakeclass.prototype.start = function() {
      while(1){
          if(this.collision()){
              console.log("game over");
              break;
          }
  
          this.movesnake();
  
          // delay here by 300 miliseconds
      }
  };
  </code></pre>
  
  <p>how can i use Set Timeout function here;</p>