Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Решение с масив и тернарен оператор:
- function dayOfWeek(num) {
- let dayOfWeek = ["Invalid day!","Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"];
- console.log(num >= dayOfWeek.length ? dayOfWeek[0] : dayOfWeek[num]);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement