if else statement in JavaScript

We can use if/else statement to executes a block of code if a specified condition is true. If the condition is false, another block of code can be executed.

<!DOCTYPE html>
<p>In this code we will check particular year is a leap year or not</p>
<script type="text/javascript">
var daysInFebruary=29;
if( daysInFebruary==29 ){
document.write("This year is a leapYear");
document.write("This is not a leapyear");

Leave a Reply

Your email address will not be published. Required fields are marked *