Beginner javascript programmer here, and I'm trying to create a complicated variable.
var mainList = [{
value : 1,
mainQuestion : 'Question1',
answerChoices : ['Answer 1', 'Answer 2', 'Answer 3']
},
{
value : 2,
mainQuestion : 'Question 2',
answerChoices : ['Answer 1', 'Answer 2']
}];
The issue I'm having, is that I need to associate values with the answers. This is going to be a set of questions, that narrows things down to where it helps get you to the right information to help solve your problem.
So how can I associate a value with the answers (Answer 1, Answer 2) ? Basically I'm needing the value associated with these answers to be added to a list element on the page, so that I can continue with further questions. I've tried turning them into another object, but keep getting console errors, and can't get it to work.
Any help is greatly appreciated.
Edit: Wow, you guys are fast and super helpful. Consider this resolved, as I've been given plenty of information to get this to work. Thank you so much!