Advertisement
CR7CR7

switch clause

Sep 18th, 2022
622
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.59 KB | None | 0 0
  1. let input = [
  2.   '6',
  3. ];
  4.  
  5. let print = this.print || console.log;
  6. let gets = this.gets || ((arr, index) => () => arr[index++])(input, 0);
  7.  
  8. let day = +gets();
  9.  
  10. switch (day) {
  11.   case 1:
  12.     console.log('Monday');
  13.     break;
  14.   case 2:
  15.     console.log('Tuesday');
  16.     break;
  17.   case 3:
  18.     console.log('Wednesday');
  19.     break;
  20.   case 4:
  21.     console.log('Thursday');
  22.     break;
  23.   case 5:
  24.     console.log('Friday');
  25.     break;
  26.   case 6:
  27.     console.log('Saturday');
  28.     break;
  29.   case 7:
  30.     console.log('Sunday');
  31.     break;
  32.  
  33.   default:
  34.     console.log('Invalid day');
  35.     break;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement