إنشاء عداد الرقم وعرضة في صفحة html in javascript

<!DOCTYPE html>
<html>
<head>
    <title>Counter</title>
</head>
<body>
    <h1 id="counter">0</h1>

    <script>
        let counter = 0;
        const counterElement = document.getElementById("counter");

        function increaseCounter() {
            counter++;
            counterElement.textContent = counter;
        }

        setInterval(increaseCounter, 1000); // Update the counter every second
    </script>
</body>
</html>
437 chars
22 lines

related categories

gistlibby LogSnag