0

Date methods of date object in JS

function printTime() { var d = new Date(); var hours = d.getHours(); var mins = d.getMinutes(); var secs = d.getSeconds(); document.body.innerHTML = hours+":"+mins+":"+secs; } setInterval(printTime, 1000); How can I print the current time once every second to my laptop screen. Please care to expand. Thanks in advance.

6th Aug 2018, 1:12 PM
kp kalia
kp kalia - avatar
1 Odpowiedź
0
Laptop screen? Did you mean browser screen in fact?
6th Aug 2018, 2:03 PM
Calviղ
Calviղ - avatar