-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathday_of_week.js
More file actions
37 lines (35 loc) · 946 Bytes
/
Copy pathday_of_week.js
File metadata and controls
37 lines (35 loc) · 946 Bytes
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
/*
Write a program that displays the day of the week for a number in the range
1 through 7.
The program shoule dislay the crresponding day of the week, where 1 = Monday
2 = Tuesday, 3 = Wednesday, 4 = Thursday, 5 = Friday, 6 = Saturday,
7 = Sunday. The program should display an error message if the user
enters a number that is outside of the range of 1 through 7.
*/
var day = 1;
switch(day) {
case 1:
console.log("That day is Monday");
break;
case 2:
console.log("That day is Tuesday");
break;
case 3:
console.log("That day is Wednesday");
break;
case 4:
console.log("That day is Thursday");
break;
case 5:
console.log("That day is Friday");
break;
case 6:
console.log("That day is Saturday");
break;
case 7:
console.log("That day is Sunday");
break;
default:
console.log("Sorry, incorrect day.");
break;
}