JavaScript Program to check whether the given year is leap or not

Write a JavaScript program to find out whether the given year is leap or not. Use prompt box to input the year.



Source Code
<html>
<head>
    <title>Find given year is leap or not</title>
</head>
<body>
<script language="javascript" type="text/javascript">  
    var year = prompt("Enter the year", "2019");
    year = parseInt(year);

    if(((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0))
    {
        document.write(year + " is a Leap year.");
    }
    else
    {
        document.write(year + " is not a Leap year.");
    }
</script>
</body>
</html>
Output