generated from yeakatie/web-1-final
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
61 lines (51 loc) · 1.6 KB
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
console.log("Hello World, Page Loaded");
const countdownElement = document.querySelector(".countdown-timer");
const countdown = new Date("2024-12-31T23:59:59").getTime();
const updateCountdown = () => {
const now = new Date().getTime();
const distance = countdown - now;
const days = Math.floor(distance / (1000 * 60 * 60 * 24));
const hours = Math.floor(
(distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)
);
const minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
const seconds = Math.floor((distance % (1000 * 60)) / 1000);
countdownElement.textContent = `${days}d ${hours}h ${minutes}m ${seconds}s`;
if (distance < 0) {
clearInterval(countdownInterval);
countdownElement.textContent = "Countdown finished!";
}
};
const countdownInterval = setInterval(updateCountdown, 1000);
// function getRandomEmoji() {
// var emojis = [
// "❤️",
// "😍",
// "💖",
// "😊",
// "🥰",
// "🫶",
// "💜",
// "💛",
// "🖤",
// "💚",
// "🧡",
// "😻",
// "🤍",
// "🩷",
// "🩶",
// "🩵",
// "💙",
// "😎",
// "♥",
// "♡",
// "❤",
// ]; // Add more emojis as needed
// var randomIndex = Math.floor(Math.random() * emojis.length);
// return emojis[randomIndex];
// }
// Set a random emoji on page load
// document.getElementById("random-emoji").innerText = getRandomEmoji();
// copyright-year should always be the current year i.e. 2023
// const currentYear = new Date().getFullYear();
// document.getElementById("copyright-year").innerHTML = currentYear;