function myClock (e) {
var today = new Date()
var h = today.getHours()
var m = today.getMinutes()
var s = today.getSeconds()
m = addZero(m)
s = addZero(s)
e.innerHTML = h + ':' + m + ':' + s
setTimeout(function () {
myClock(e)
}, 1000)
}
function addZero (num) {
return num >=10 ? num : '0' + num
}
var clockDemo = document.getElementById('clockDemo')
myClock(clockDemo)