Ich bin neu in der Programmierung. Ich habe ein bisschen JavaScript gelernt und einen Code erstellt. Es war alles in Ordnung, wenn alles wahr war, aber ich musste etwas hinzufügen, um zu geschehen, wenn es falsch ist. Also habe ich eine while
hinzugefügt und es hat nicht funktioniert für mich. Jemand kann mir bitte helfen? Danke für die Antworten!Kann nicht herausfinden, was in diesem Code falsch ist
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8"/>
<link rel="stylesheet" href="styles.css"/>
<script src="JavaScript.js"></script>
<title>
Hello
</title>
</head>
<body>
<p id="Hello"></p>
<script>
function onload() {
alert("choose a number between 1 and 9");
var Multiply1 = prompt("Multiply this number by 9");
while (Multiply1 % 9 != 0) {
alert("This can't be true");
var Multiply = prompt("Multiply this number by 9");
}
while (multiply1 % 9 = 0) {
var add = prompt("Add the 2 digits you have");
}
while (add != 9) {
alert("This can't be true");
var add1 = prompt("Add the 2 digits you have");
}
while (add = 9) {
var decrease = prompt("deacrease the number you have chosen from the number you got:");
alert("the number you have chosen is " + (9-decrease));
}
}
</script>
<noscript>Please enable JS</noscript>
<button onclick="onload()">Cilck on me to start"</button>
</body>
</html>
Willkommen bei Stack-Überlauf. Bitte lesen Sie http://stackoverflow.com/help/how-to-ask, was Ihnen hilft, Fragen gut zu stellen. Wie es aussieht, ist diese Frage in der Kategorie "Warum funktioniert dieser Code nicht?", Die entfernt wird. Wir möchten, dass Sie sich Mühe geben, ein Problem zu lösen, uns nicht nur den Code zeigen und fragen, warum das nicht funktioniert. – Mikkel