63 lines
No EOL
1.2 KiB
JavaScript
63 lines
No EOL
1.2 KiB
JavaScript
// Chipsregen
|
|
|
|
console.log ("Meine Seite läuft");
|
|
|
|
function createChip() {
|
|
|
|
const chip = document.createElement("img");
|
|
|
|
chip.src = "img/Chips.png";
|
|
|
|
chip.classList.add("chip");
|
|
|
|
chip.style.left = Math.random() * window.innerWidth + "px";
|
|
|
|
chip.style.animationDuration =
|
|
(Math.random() * 3 + 3) + "s";
|
|
|
|
chip.style.width =
|
|
(Math.random() * 50 + 50) + "px";
|
|
|
|
document.body.appendChild(chip);
|
|
|
|
setTimeout(() => {
|
|
chip.remove();
|
|
}, 6000);
|
|
}
|
|
|
|
setInterval(createChip, 300);
|
|
|
|
|
|
|
|
/// Notenrechner
|
|
|
|
function berechneNote(punkte) {
|
|
if (punkte < 50) {
|
|
return "nicht bestanden";
|
|
}
|
|
else if (punkte < 60) {
|
|
return "ausreichend";
|
|
}
|
|
else if (punkte < 75) {
|
|
return "befriedigend";
|
|
}
|
|
else if (punkte < 90) {
|
|
return "gut";
|
|
}
|
|
else {
|
|
return "sehr gut";
|
|
}
|
|
}
|
|
|
|
function startNotenrechner() {
|
|
const punkte = Number(prompt("Wie viele Punkte hast du erreicht?"));
|
|
const max = Number(prompt("Maximale Punktzahl?"));
|
|
|
|
const prozent = (punkte / max) * 100;
|
|
|
|
const ergebnis =
|
|
punkte + " von " + max + " Punkten (" + prozent + "%) = " + berechneNote(punkte);
|
|
|
|
console.log(ergebnis);
|
|
alert(ergebnis);
|
|
} |