Day 3: Find the Day
Submissions will no longer be placed on the leaderboard. You may still attempt this problem for practice.
Write a JavaScript function to get the day of a particular date.
Recommended Reference
W3 Schools has a nice tutorial on JavaScript dates.
Also, here's a useful YouTube video related to the topic:
Input Format
Several lines of input containing dates in MM/DD/YYYY format.
The program should end when it encounters .
Output Format
Print the day of the week indicated by the date for each line of input on a separate line.
Sample Input
10/11/2009
11/10/2010
-1
Sample Output
Sunday
Wednesday
xxxxxxxxxx
22
1
2
3
function findDay(myDate) {
4
// Return day for date myDate(MM/DD/YYYY)
5
// Note that myDate contains the date in string format
6
}
7
8
// tail starts here
9
process.stdin.resume();
10
process.stdin.setEncoding("ascii");
11
_input = "";
12
process.stdin.on("data", function (input) {
13
_input += input;
14
});
15
16
process.stdin.on("end", function () {
17
var dates = _input.split('\n');
18
19
for (var i = 0; i < dates.length - 1; i++) {
20
findDay(dates[i]);
21
}
22
});