Advertisement
CR7CR7

switchfallthrough

Sep 18th, 2022
648
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. let input = [
  2.   '5',
  3. ];
  4.  
  5. let print = this.print || console.log;
  6. let gets = this.gets || ((arr, index) => () => arr[index++])(input, 0);
  7.  
  8. let month = +gets();
  9.  
  10. console.log('Remaining months to the end of the year:')
  11. switch (month) {
  12.   case 1:
  13.     console.log('January');
  14.   case 2:
  15.     console.log('February');
  16.   case 3:
  17.     console.log('March');
  18.   case 4:
  19.     console.log('April');
  20.   case 5:
  21.     console.log('May');
  22.   case 6:
  23.     console.log('June');
  24.   case 7:
  25.     console.log('July');
  26.   case 8:
  27.     console.log('August');
  28.   case 9:
  29.     console.log('September');
  30.   case 10:
  31.     console.log('October');
  32.   case 11:
  33.     console.log('November');
  34.   case 12:
  35.     console.log('December');
  36.  
  37.   default:
  38.     break;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement