This commit is contained in:
Philippe Torrel
2026-09-15 12:12:38 +02:00
parent ee8cc31e77
commit 90f79dd5ac
10 changed files with 468 additions and 2 deletions
+35 -1
View File
@@ -37,8 +37,42 @@
<script>
'use strict';
const year = Number(prompt('please enter year:'));
const year = Number(prompt('Gib ein Jahr ein:'));
const outputEl = document.querySelector('.output');
if (year % 400 === 0) {
console.log(`${year} ist ein Schaltjahr.`);
} else if (year % 100 === 0) {
console.log(`${year} ist KEIN Schaltjahr.`);
} else if (year % 4 === 0) {
console.log(`${year} ist ein Schaltjahr.`);
} else {
console.log(`${year} ist KEIN Schaltjahr.`);
}
// if (year % 400 === 0) {
// outputEl.innerHTML = `${year} ist ein Schaltjahr.`;
// } else if (year % 100 === 0) {
// outputEl.innerHTML = `${year} ist KEIN Schaltjahr.`;
// } else if (year % 4 === 0) {
// outputEl.innerHTML = `${year} ist ein Schaltjahr.`;
// } else {
// outputEl.innerHTML = `${year} ist KEIN Schaltjahr.`;
// }
const checkOne = year % 400 === 0;
const checkTwo = year % 100 !== 0 && year % 4 === 0;
let output = '';
// if (checkOne || checkTwo) {
// output = `${year} ist ein Schaltjahr!`;
// } else {
// output = `${year} ist kein Schaltjahr`;
// }
// outputEl.innerText = output;
outputEl.textContent = checkOne || checkTwo ? `${year} ist ein Schaltjahr!` : `${year} ist kein Schaltjahr`;
</script>
</body>
</html>