How do I fix this to present the score at the end? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How do I fix this to present the score at the end?

https://code.sololearn.com/W7e5cd0l71j1/?ref=app

29th Apr 2020, 8:04 PM
3.14
3.14 - avatar
2 Answers
+ 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
29th Apr 2020, 8:11 PM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar
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}
30th Apr 2020, 2:21 AM
visph
visph - avatar