user10750605
user10750605

Reputation:

Quiz generator and randomization in Javascript

Every time I add a 1 or a 2 for the correct answer it gives me something else. Can anyone help. I have also provided a Jsfiddle link that way you can see the HTML CSS and JavaScript put together. I don't know why the answers are not showing up. Or if they are they are not the correct answer.

  let quiz = (function() {
    let getFinalResultsString = (score, questionsCount) => {
      //Stop timer here
      clearInterval(interval);
      score = 0;
    };

Upvotes: 1

Views: 94

Answers (1)

ViqMontana
ViqMontana

Reputation: 5688

You are setting the score value to 0 in your getFinalResultsString() function. Remove the line score = 0; and it should work as expected. I've also updated your JSFiddle.

The answer for the first question is 'her' as you have set the answer index to 1; don't forget that JavaScript uses 0 based indexing.

Upvotes: 2

Related Questions