+ 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 Answer
+ 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.