tsekotsolov

Month Printer

Sep 30th, 2018
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function monthPrinter (number) {
  2.   let months = {
  3.     1: 'January',
  4.     2: 'February',
  5.     3: 'March',
  6.     4: 'April',
  7.     5: 'May',
  8.     6: 'June',
  9.     7: 'July',
  10.     8: 'August',
  11.     9: 'September',
  12.     10: 'October',
  13.     11: 'November',
  14.     12: 'December'
  15.   }
  16.   let month = months[number]
  17.   if (month) {
  18.     console.log(month)
  19.     return
  20.   }
  21.   console.log('Error!')
  22. }
Advertisement
Add Comment
Please, Sign In to add comment