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-15 12:59:38 +01:00
year = window.prompt("Input a Year : ");
x = (year % 100 === 0) ? (year % 400 === 0) : (year % 4 === 0);
alert(x);