programming-examples/js/Basic/Write a JavaScript program to determine whether a given year is a leap year in the Gregorian calendar..js

3 lines
120 B
JavaScript
Raw Normal View History

2019-11-18 14:44:36 +01:00
year = window.prompt("Input a Year : ");
x = (year % 100 === 0) ? (year % 400 === 0) : (year % 4 === 0);
alert(x);