javascript
Published on January 26, 2024By DeveloperBreeze
// Function to check if a year is a leap year
function isLeapYear(year) {
return (year % 4 === 0 && year % 100 !== 0) || (year % 400 === 0);
}
// Example: Check if the year 2024 is a leap year
const year = 2024;
console.log('Is Leap Year:', isLeapYear(year));
Comments
Please log in to leave a comment.