+ 1

This Javascript code is not running of my screen, can any one tell me why?

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);

9th Jul 2018, 1:03 PM
Falodun Ebenezer Tosin
2 Answers
0
I just opened it myself in the SoloLearn console. It works fine for me. Perhaps you have made an error elsewhere, like the HTML part is wrong, or a bug in an earlier line stops the JS. What exactly happens when you run the code? Does the console report an error?
9th Jul 2018, 1:13 PM
James
James - avatar
0
Thank you James It's working on sololearn console but on my laptop, it is not...and I can't find any bug
9th Jul 2018, 2:18 PM
Falodun Ebenezer Tosin