Skip to content

Commit c96235b

Browse files
committed
Add funtionality
1 parent 8365e04 commit c96235b

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

Source-Code/DayPredictor/script.js

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
document.addEventListener('DOMContentLoaded', () => {
2+
// Grab day of the week from local computer
3+
const date = new Date();
4+
const dayOfWeekNumber = date.getDay();
5+
let nameOfDay;
6+
let quote;
7+
8+
switch (dayOfWeekNumber) {
9+
case 0:
10+
nameOfDay = 'Sunday';
11+
quote = 'Time to chillax!';
12+
break;
13+
case 1:
14+
nameOfDay = 'Monday';
15+
quote = 'Monday morning blues!';
16+
break;
17+
case 2:
18+
nameOfDay = 'Tuesday';
19+
quote = 'Taco Time!';
20+
break;
21+
case 3:
22+
nameOfDay = 'Wednesday';
23+
quote = 'Two more days to the weekend.';
24+
break;
25+
case 4:
26+
nameOfDay = 'Thursday';
27+
quote = 'The weekend is almost here...';
28+
break;
29+
case 5:
30+
nameOfDay = 'Friday';
31+
quote = 'Weekend is here!';
32+
break;
33+
case 6:
34+
nameOfDay = 'Saturday';
35+
quote = 'Time to party!';
36+
break;
37+
default:
38+
nameOfDay = 'Unknown';
39+
quote = '';
40+
}
41+
42+
// Display the day of the week
43+
const weekdayDiv = document.getElementById('weekday');
44+
weekdayDiv.innerHTML = `${nameOfDay}`;
45+
46+
// Display quote
47+
const quoteDiv = document.getElementById('phrase');
48+
quoteDiv.innerHTML = `${quote}`;
49+
});

0 commit comments

Comments
 (0)