In questo articolo illustreremo una semplice soluzione per verificare se un anno è bisestile con JavaScript.
La soluzione è la seguente:
'use strict';
function isLeapYear(year) {
return ((year % 4 === 0 && year % 100 !== 0) || year % 400 === 0);
}
L'autore
Sono uno Sviluppatore Web Full Stack, ho contribuito alla W3C CSS Test Suite,
sono esperto in Node.js,
jQuery,
CSS, HTML5, XML, XSLT, DOM, SVG, AJAX, Angular, LAMP-Stack, MEAN-Stack,
JavaScript, JSON, PHP, WordPress, Laravel
e autore su Smashing Magazine e Html.it.