Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion js/date.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ console.log("Current Day (id): " + d.getDay());
// Return the weekday
// Create an array for the weekday [names]
var weekday = new Array(7);
weekday[0] = "Sunday";
weekday[0] = "Sunday";
weekday[1] = "Monday";
weekday[2] = "Tuesday";
weekday[3] = "Wednesday";
Expand All @@ -29,3 +29,9 @@ weekday[6] = "Saturday";

// Map the current day to the weekday name and output it to the console
console.log("Current Weekday: " + weekday[d.getDay()]);

if (d.getDay() == 0 || d.getDate == 6) {
console.log("Today is weekend");
} else {
console.log("Its not a weekend");
}