DEV Community

Cover image for JavaScript Program to Check Leap Year Using Conditional Operator
ali-dev-hash
ali-dev-hash

Posted on

JavaScript Program to Check Leap Year Using Conditional Operator

JavaScript Program to Check Leap Year Using Conditional Operator

must support == > https://codepen.io/Bilal1909/pen/dyNzzMz

Top comments (1)

Collapse
 
grahamthedev profile image
GrahamTheDev

I mean it doesn't actually work 😋

1600 - leap year
1700 - not a leap year
1800 - not a leap year
1900 - not a leap year
2000 - leap year.

If the year is divisible by 100 it is not a leap year.

Unless it is divisible by 400, in which case it is a leap year.

A fun one for you to fix, not that it will matter for another 79 years!