0
How do I fix this to present the score at the end?
2 Antworten
+ 4
AB Coder , all of the variables in your function should access the value property. Look at the code 🐱
https://code.sololearn.com/W3BD2wsUPv0e/?ref=app
0
in your function validate you do:
var n1 = document.getElementById('num1');
var n2 = document.getElementById('num2');
if (n1.value == n2.value)
ypu should do similar in your function rating...
actually:
var pe1 = document.getElementById("pe");
if(pe1 > 1){score += 1}
var pb1 = document.getElementById("pb");
if(pb1 > 1){score += 1}
var cr1 = document.getElementById("cr");
if(cr1 > 1){score += 1}
but should be:
var pe1 = document.getElementById("pe");
if(pe1.value > 1){score += 1}
var pb1 = document.getElementById("pb");
if(pb1.value > 1){score += 1}
var cr1 = document.getElementById("cr");
if(cr1.value > 1){score += 1}
or alternatively:
var pe1 = document.getElementById("pe").value;
if(pe1 > 1){score += 1}
var pb1 = document.getElementById("pb").value;
if(pb1 > 1){score += 1}
var cr1 = document.getElementById("cr").value;
if(cr1 > 1){score += 1}