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; }
7 odpowiedzi
+ 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
0
Ok try again
0
It doesn't work even when I tried the way you told me to do.
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(){
0
I made many modifications, it works really well
0
n
0
@Thomas Hj