+ 1
I have created sample quiz project.But score is not counting.what is wrong in my code
10 ответов
+ 7
A possible way is:
https://code.sololearn.com/W2TKTErU8Tg2/?ref=app
+ 4
Additional to Lisa‘s hint will be needed to optimize your code because of infinite score‘s addition.
+ 3
When ever you try the correct answers of a question the score still increments, find a way to increment the score just once for the first time you tap the correct answer.
+ 2
You keep resetting the score to 0 whenever the option() function is called (Javascript, line 2)
+ 2
Thank you so much to all 😊
+ 1
Hi Susheela
In js file move the var score=0; variable to outside of the function.
try to add a answer object with correct value of each question and use them in condition to prevent from score increments every time when user click on correct answers.
+ 1
Yasin rahnaward
Tq for this code
But i don't how to add answer object
+ 1
I created a sample code. Select "7" and "skyblue" and press answer button to get the score.
https://www.sololearn.com/compiler-playground/WD9pEHV8EM47
+ 1
Tq Lisa
But how to i reset the score to 0