Question
javascript Javascript Write an event handler so that when the user clicks the Check Year button, a function executes. This function should get a four
Javascript
Write an event handler so that when the user clicks the Check Year button, a function executes. This function should get a four digit year from the user and print out to the webpage whether or not the year is a leap year.
The first step is to validate the user input. This is done by checking to make sure the user enters a year larger than or equal to 1582. If the year is less, you should print an error message to the page.
Otherwise, you need to determine if the year the user entered is a leap year. A year is a leap year if it is divisible by four, unless it is also divisible by 100 but not divisible by 400. Then print to the page whether the year is a leap year or not.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started