diff --git a/main.js b/main.js index 40730c0..e6eb6d7 100644 --- a/main.js +++ b/main.js @@ -5,7 +5,7 @@ const minute = second*60; const hour = minute*60; const day = hour*24; -setInterval(() => { +const update_countdown = () => { const now = new Date(); const diff = target - now; @@ -23,4 +23,7 @@ setInterval(() => { document.getElementById(unit).innerHTML = value; }); -}, 500); \ No newline at end of file +}; + +update_countdown(); +setInterval(update_countdown, 500); \ No newline at end of file