Notenrechner ausführbar machen (bisher passiert nichts)
This commit is contained in:
parent
19f019c5a0
commit
5603376267
1 changed files with 6 additions and 1 deletions
|
|
@ -53,7 +53,12 @@ function startNotenrechner() {
|
|||
const punkte = Number(prompt("Wie viele Punkte hast du erreicht?"));
|
||||
const max = Number(prompt("Maximale Punktzahl?"));
|
||||
|
||||
const prozent = (punkte / max) * 100;
|
||||
if (max === 0 || isNaN(max) || isNaN(punkte)) {
|
||||
alert("Bitte gültige Zahlen eingeben!");
|
||||
return;
|
||||
}
|
||||
|
||||
const prozent = Math.round((punkte / max) * 100);
|
||||
|
||||
const ergebnis =
|
||||
punkte + " von " + max + " Punkten (" + prozent + "%) = " + berechneNote(punkte);
|
||||
|
|
|
|||
Loading…
Reference in a new issue