<!DOCTYPE html>
<html>
<body>
<h2>JavaScript new Date()</h2>
<p id="demo"></p>
<script>
setInterval(myFunction,1000);
function myFunction() {
let d = new Date();
document.getElementById("demo").innerHTML = d.getSeconds();
setInterval(myFunction,1000);
}
</script>
</body>
</html>