How to create or reset counters with JavaScript?

To create counters, use the counterReset property in JavaScript. You can try to run the following code to create or reset one or more counters with JavaScript −


Live Demo

<!DOCTYPE html>
         h2:before {
            counter-increment: section;
            content: counter(section) " Quiz ";
      <p>Change the counterIncrement</p>
      <h2 id="myID">Java</h2>
      <button onclick="display()">Reset Counter</button>
         function display() {
   = "section";
karthikeya Boyini
karthikeya Boyini

I love programming (: That's all I know