// Main game loop
function gameLoop() {
// game logic
// Next frame
requestAnimationFrame(gameLoop);
}
// Start the loop
gameLoop();
Every time js is edited, new instance of game loop starts in the browser. hard reset helps though.