+ 1

Whats wrong with my code?[SOLVED]

In my code when a user clicks question a question is posed saying how may days are in a year , when yous insert 366 which is one of the correct answer it displays wrong yet it has to display correct , whereas if you insert 365 it displays correct which is also one of the answer expected. The Code is below. https://code.sololearn.com/WIQtuNbLI46m/?ref=app

10th Oct 2020, 7:14 AM
Astrav
Astrav - avatar
4 Réponses
+ 1
Astron Daniel hi, When you ask if(question===answer[ 0, 2 ]) I think it check every value in order and return the last checked. You can try by swapping 366 by 365 and vice versa to see. So the || operator as said by Aswajith K.K should solve that issue.
10th Oct 2020, 11:21 AM
EmmanueLZ.
EmmanueLZ. - avatar
+ 4
Try using or operator(||)
10th Oct 2020, 7:17 AM
Aswajith
Aswajith - avatar
+ 3
Thanks Aswajith K.K , Thanks EmmanueLZ i tried the operator and it worked
10th Oct 2020, 3:19 PM
Astrav
Astrav - avatar
10th Oct 2020, 7:31 AM
🔰Saurabh🔰
🔰Saurabh🔰 - avatar