SoFunction
Updated on 2025-03-10

JavaScript implements simple clock instance code


<html>

<head>

<title>JS implements simple clock</title>
<script>

    function displayTime() {
        ("time").innerHTML = new Date().toTimeString();
    }

setInterval(displayTime,1000);       // Call the displayTime function every 1 second
</script>
</head>

<body>
    <p ></p>
</body>

</html>