Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function weekendOrWorkingDay(day) {
- if (day == "Monday" || day == "Tuesday" || day == "Wednesday" || day == "Thursday" || day == "Friday") {
- console.log("Working day");
- } else if (day == "Saturday" || day == "Sunday") {
- console.log("Weekend");
- } else {
- console.log("Error");
- }
- }
- Второ решение(switch):
- function weekendOrWorkingDay(input) {
- let day = input[0];
- switch (day) {
- case "Monday":
- case "Tuesday":
- case "Wednesday":
- case "Thursday":
- case "Friday":
- console.log("Working day");
- break;
- case "Saturday":
- case "Sunday":
- console.log("Weekend");
- break;
- default:
- console.log("Error");
- break;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement