clock

vanila js clock

by Yuriy Petrichenko

HTML

<h1></h1>

CSS

h1{
  color:#fff;
  background:#333;
}

JavaScript

function clock(){
var time = new Date();
hour=time.getHours()
minutes= time.getMinutes()
seconds= time.getSeconds()
document.querySelector('h1').innerHTML= hour +" : "+ minutes +" : "+seconds;
}
setInterval(clock,1000);