HTML Editor
<!DOCTYPE html> <html lang="en-US"> <body> <h1>JS Leap Year or Not</h1> <script> var year = 2012; if(year % 4 == 0) { if((year % 100 == 0) && (year % 400 != 0)) document.write(year+" is not a leap year"); else document.write(year+" is a leap year"); } else document.write(year+" is not a leap year"); </script> </body> </html>
OUTPUT
×

Save as Private