-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
42 lines (42 loc) · 1.11 KB
/
main.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
document.title = "project-js-6";
let date = new Date();
let color = "";
let div = document.getElementById("div");
if (date.getDay() === 0) {
color = "red";
div.innerHTML = "Sunday";
} else if (date.getDay() === 1) {
color = "yellow";
div.innerHTML = "Monday";
} else if (date.getDay() === 2) {
color = "pink";
div.innerHTML = "Tuesday";
} else if (date.getDay() === 3) {
color = "green";
div.innerHTML = "Wednesday";
} else if (date.getDay() === 4) {
color = "orange";
div.innerHTML = "Thursday";
} else if (date.getDay() === 5) {
color = "blue";
div.innerHTML = "Friday";
} else if (date.getDay() === 6) {
color = "purple";
div.innerHTML = "Saturday";
} else {
color = "white";
div.innerHTML = "No Day";
}
document.body.style.cssText = `
background-color: ${color};
margin: 0;
padding: 0;
height: 100vh;
display: flex;
align-items: center;
justify-content: center;
color: white;
font-size: 40px;
`;
console.log("color ".toUpperCase() + color.toUpperCase() + " " + div.innerHTML.toUpperCase());
document.body.appendChild(div);