JavaScript Program to find leap year or not

This program is for School / College students who are in the beginner level and wants to get a good knowledge in JavaScript.

To find the leap year, below three conditions has to be satisfied,

1. Year should be evenly divisible by 4 (year % 4 == 0)
2. AND (&&) Year should not be evenly divisible by 100 (year % 100 != 0)
3. OR (||) year should be evenly divisible by 400 (Year % 400 == 0)

if both the 1st AND 2nd condition is true OR 3rd is true then it is a Leap year.


Here is the JavaScript function to find leap year:

What will you learn from this JavaScript program?

1. You will learn how to get the value of a text box using document.getElementByID()

2. How to use multiple if conditions in a single line


A complete demo program for you to check immediately:



Related Posts

Leave a Reply