rewrite clock script

This commit is contained in:
Gerome Matilla 2020-06-04 07:51:25 +08:00
parent 31bf7fe60d
commit 49a2462854

View File

@ -1,7 +1,7 @@
var clock = document.getElementById("clock")
// Append 0 before time elements if less hour's than 10
function appendZero(k) {
const appendZero = (k) => {
if (k < 10) {
return "0" + k;
} else {
@ -9,7 +9,8 @@ function appendZero(k) {
}
}
function currentTime() {
// Update/Set clock
const currentTime = () => {
// Date object
var date = new Date();
@ -33,6 +34,6 @@ function currentTime() {
var t = setTimeout(currentTime, 1000);
}
// Start
// Start clock
window.onload = currentTime();