Skip to main content

Exercise 62

  • Create a new index62.js file
  • Define monthNumber variable and assign a number between 1 and 12
  • Define monthName variable and assign null as value
  • define monthDays variable and assign null as value
  • Use a switch statement
  • Depending the monthNumber value assign the corresponding monthName and monthDays values
    1. January - 31 days
    2. February - 28 days in a common year and 29 days in leap years
    3. March - 31 days
    4. April - 30 days
    5. May - 31 days
    6. June - 30 days
    7. July - 31 days
    8. August - 31 days
    9. September - 30 days
    10. October - 31 days
    11. November - 30 days
    12. December - 31 days
  • If monthName & monthDays are null then show an error message
  • Else show the following message: %monthName% is the selected month and has %monthDays%
  • Try all the posible cases/scenarios (even the error message) by changing the weekdayNumber value