const input_number = document.querySelector("#input-number");
const output = document.querySelector("#output");
const btn_submit = document.querySelector("#btn-submit");

/**
 * Based on: https://en.wikipedia.org/wiki/Leap_year#Algorithm
*/
function is_leap(year)
{
    if (year % 4 != 0 && year % 400 != 0)
    {
        return false;
    }
    return true;
}

btn_submit.addEventListener("click", (event) => {
    const year = input_number.value;
    if (is_leap(year))
    {
        output.textContent = `Year ${year} is leap`;
    }
    else
    {
        output.textContent = `Year ${year} is NOT leap`;
    }
});
