{"size": 1067, "ext": "js", "max_stars_repo_path": "JSCore/JS-Core-Fundamentals/03FunctionsAndLogicFlow/FunctionsAndLogicFlowExer/01_Leap-Year/solution.js", "max_stars_repo_name": "TihomirIvanovIvanov/SoftUni", "max_stars_repo_stars_event_min_datetime": "2019-04-12T11:32:37.000Z", "max_stars_repo_stars_event_max_datetime": "2021-11-20T05:02:59.000Z", "max_issues_repo_path": "JSCore/JS-Core-Fundamentals/03FunctionsAndLogicFlow/FunctionsAndLogicFlowExer/01_Leap-Year/solution.js", "max_issues_repo_name": "TihomirIvanovIvanov/SoftUni", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "JSCore/JS-Core-Fundamentals/03FunctionsAndLogicFlow/FunctionsAndLogicFlowExer/01_Leap-Year/solution.js", "max_forks_repo_name": "TihomirIvanovIvanov/SoftUni", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 3, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 31.3823529412, "max_line_length": 80, "alphanum_fraction": 0.4339268978}
(function () {
    function test() {
        let checkBtn = document.querySelector("button");
        checkBtn.addEventListener("click", function () {
            let input = document.querySelector("input");
            let targetH = document.querySelector("#year h2");
            let targetDiv = document.querySelector("#year div");

            function isLeap(year) {
                if (+year % 4 === 0 && +year % 100 !== 0) {
                    return true;
                }
                if (+year % 4 === 0 && +year % 100 === 0 && +year % 400 === 0) {
                    return true;
                }
                return false;
            }

            let year = +input.value;
            if (isLeap(year)) {
                targetH.innerHTML = "Leap Year";
                targetDiv.innerHTML = input.value;
            } else {
                targetH.innerHTML = "Not Leap Year";
                targetDiv.innerHTML = input.value;
            }
            input.value = '';
        })
    }

    return function () {
        test()
    }
})();