Advertisement
Spocoman

02. Day of Week

Jan 20th, 2022
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Решение с масив и тернарен оператор:
  2.  
  3.  
  4. function dayOfWeek(num) {
  5.  
  6.     let dayOfWeek = ["Invalid day!","Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"];
  7.  
  8.     console.log(num >= dayOfWeek.length ? dayOfWeek[0] : dayOfWeek[num]);
  9. }
  10.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement