I'm new to programming. I've learned a little bit of JavaScript and I made a code. It was all fine when everything was true, but I needed to add something to happen when it is false. So I added a while
and it didn't work out for me. Someone can help me please? Thank you for the answers!
<!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>