Exercism JS: Leap Year

Write a program that will take a year and report if it is a leap year.

The tricky thing here is that a leap year in the Gregorian calendar occurs:

  • Every year that is evenly divisible by 4
  • Except every year evenly divisible by 100
  • Unless the year is also evenly divisible by 400

Solution:  

screen-shot-2016-12-12-at-5-20-46-pm

Test cases.

Additional Solutions.

This problem was not challenging at all.  However, I did struggle with the JS fundamentals since I’m not at all familiar with JS yet.  This was good exposure on what to focus one:  module patterns and anonymous closures.

I found some resources here and here that may be helpful to read over.

Advertisements
Exercism JS: Leap Year

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s