+ 1
Can someone help me with a personality test? (JavaScript)
I’m trying to make a personality quiz but have hit a dead end (I’m no so good with JavaScript). How can I use the if else statement to change the next question based on the users answer? eg. the quiz is about TV shows: the first question would be “do you like comedy?”, if the answer is “yes”, it should show “have you ever watched a sitcom?”, though if the answer is “no”, than the next question would be “do violent scenes bother you?”.
1 Respuesta
+ 1
Not especially from the JavaScript view, but I don't think, you should use if-else-branches at all. If the flow is completely determined, you should rather store all questions as objects, with an attribute pointing to the respective previous answer.