Increase the Count Value by 1

Increase the Count Value by 1 when the page loads in the provided time.

<!DOCTYPE html>

<html lang="en">

<body style="text-align:center">

    <p>COUNTS</p>

    <div id="counter">

    </div>

    <script>

        let counts=setInterval(updated,150)

        let upto=0;

        function updated(){

            var count= document.getElementById("counter");

            count.innerHTML=++upto;

            if(upto==25)

            {

                clearInterval(counts);

            }

        }

    </script>

</body>

</html>

Sign In or Register to comment.