diff --git a/Chapter 11/ex4 b/Chapter 11/ex4 index 8b26228..35c8571 100644 --- a/Chapter 11/ex4 +++ b/Chapter 11/ex4 @@ -8,11 +8,11 @@ window.setTimeout(update, 1000); } function countdown() { - const total = Date.parse(endDate) - new Date(); - const seconds = Math.floor((total / 1000) % 60); - const minutes = Math.floor((total / 1000 / 60) % 60); - const hours = Math.floor((total / (1000 * 60 * 60)) % 24); + const total = Date.parse(endDate) - new Date(); const days = Math.floor(total / (1000 * 60 * 60 * 24)); + const hours = Math.floor((total / (1000 * 60 * 60)) % 24); + const minutes = Math.floor((total / 1000 / 60) % 60); + const seconds = Math.floor((total / 1000) % 60); return { total, days,