Leap year program in javascript

Prem Tiwari - - JavaScript


In this tutorial, we are going to share a leap year program in javascript with the output. The leap year is also known as an intercalary year or bissextile year. It is a calendar year containing one additional day in February month.

Leap Year Algorithm

1. if (year is not divisible by 4) then (it is a common year)
2. else if (year is not divisible by 100) then (it is a leap year)
3. else if (year is not divisible by 400) then (it is a common year)
4. else (it is a leap year)

Leap year program flowchart

leap year program in javascript

Leap year program in javascript

Below is javascript program to check leap year with the output.

Leap year program in javascript in console

Below program will print leap year on the console.

Program Output

true


About: Prem Tiwari

Prem Tiwari is the founder of FreeWebMentor.com and also a professional developer who has vast experience in PHP and open source technologies. Apart from this, he is a blogger by hobby and also he has been a regular speaker of WordPress sessions in various IT Companies.