This commit is contained in:
Philippe Torrel
2026-09-16 10:38:23 +02:00
parent 99007ffc89
commit dc1e06ac67
16 changed files with 159 additions and 27 deletions
+12 -1
View File
@@ -45,10 +45,21 @@
const inputEl = document.querySelector('.input-year');
const outputEl = document.querySelector('.output');
const isLeapYear = (year) => {
const checkOne = year % 400 === 0;
const checkTwo = year % 100 !== 0 && year % 4 === 0;
return checkOne || checkTwo;
};
let output = '';
inputEl.addEventListener('input', (e) => {
const val = e.currentTarget.value;
// TODO: check if it is a leap year or not.
output = isLeapYear(val) ? `${val} ist ein Schaltjahr` : `${val} ist KEIN Schaltjahr`;
console.log(output);
outputEl.textContent = output;
});
</script>
</body>