Content = "Stop";
          updateGrid();
        } else {
          isRunning = false;
          document.getElementById("startButton").textContent = "Start";
          cancelAnimationFrame(animationId);
        }
      }

      function clearGrid() {
        if (!isRunning) {
          grid = createEmptyGrid();
          drawGrid();
        }
      }

      drawGrid();
    </script>
  </body>
</html>

<!--

CODE EXPLANATION:

JavaScript:

The JavaScript code starts by selecting 