var res, num, num2;
next();
function next(){
while(!isGreaterThan0){
num = Math.floor(Math.random() * 10)+1;
num2 = Math.floor(Math.random() * 10)+1;
res = num-num2;
var isGreaterThan0 = res>0;
if (isGreaterThan0){
document.addEventListener("DOMContentLoaded",
function() {
var i=0;
while(i<10){
document.getElementById("number").value = parseInt(prompt(num+ " - "+ num2+ " = "));
i++;
if(document.getElementById("number").value){
check();
}
}
});
function check()
const result = document.getElementById("number").value;
if(result == res ){
next();
alert("Toppen, helt rätt!");
document.getElementById("number").value="";
} else {
document.getElementById("number").value="";
alert("Fel, försök igen")
}
}
Hello again. I have write this code, but when I try to run it it doesnt work. It say that something is wrong with line 30 ( cons result =) I have no idea what is wrong, couse when I run the code earlier it worked perfect, but now something is wrong?
anyone who knows?