An open API service indexing awesome lists of open source software.

https://github.com/jasheloper/js-calendar

Display number of days in each month.
https://github.com/jasheloper/js-calendar

conditional-statements javascript mdn

Last synced: 3 months ago
JSON representation

Display number of days in each month.

Awesome Lists containing this project

README

        

## Demo
https://jasheloper.github.io/js-calendar/

## Objective

In this example, you are going to help us finish a simple calendar application.

- MDN Link: https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Building_blocks/conditionals#active_learning_a_simple_calendar

## Instructions

- We need you to write a conditional statement inside the `onchange` handler function, just below the `// ADD CONDITIONAL HERE` comment.

- Look at the selected month (stored in the `choice` variable. This will be the `` element value after the value changes, so "January" for example.)

- Set a variable called `days` to be equal to the number of days in the selected month. To do this you'll have to look up the number of days in each month of the year. You can ignore leap years for the purposes of this example.


Hints:

- You are advised to use logical OR to group multiple months together into a single condition; many of them share the same number of days.

- Think about which number of days is the most common, and use that as a default value.