0

I can't stop the number turning into NaN.

This is the js file: /*Quiz.js sees how many write, wrong */ function information(){ studentName = prompt("What is your name?"); } var quiz = 0; function questions(quiz){ q1 = confirm("Are we in the ming dinesty"); if(q1==false){ quiz++; } q2 = confirm("The great wall made one time."); if(q2==false){ quiz++; } q3 = confirm("There are four types of yin."); if(q1!=false){ quiz++; } q4 = confirm("The biggest word is biang"); if(q1!=false){ quiz++; } q5 = confirm("There is no decimeter in chinese"); if(q1!=false){ quiz++; } document.write(studentName+" earned "+quiz+" out of 5."); return quiz; }

30th Sep 2016, 1:29 PM
Trey
7 Respuestas
+ 1
one thing.... if you are using q1,q2,q3,q4,q5.. for first u used q1 in if condition.. and q2 in second if condition.. but for other questions you used q1.. correct those.. another thing.. define these q1 to q5 and quiz variable inside this function questions
30th Sep 2016, 2:01 PM
Avinash singh
Avinash singh - avatar
0
Ok try again
3rd Oct 2016, 12:45 AM
Azuesious2603
Azuesious2603 - avatar
0
It doesn't work even when I tried the way you told me to do.
3rd Oct 2016, 4:30 AM
Trey
0
You overwritten 'quiz' variable, that is way you get this 'NaN' output. -------------------------------- var quiz = 0; function questions(quiz){ Change too: var quiz = 0; function questions(){
4th Oct 2016, 8:40 AM
Thomas Hj
Thomas Hj - avatar
0
I made many modifications, it works really well
7th Oct 2016, 9:00 AM
Trey
0
n
22nd Oct 2016, 3:56 AM
Ke'Aundrae Heard (Keatuh)
Ke'Aundrae Heard (Keatuh) - avatar
0
@Thomas Hj
13th Nov 2016, 4:59 PM
DTS258098
DTS258098 - avatar