A linked list (or not), how in this case?

There is a small table with tabs and questions in each tab.
All questions are dynamically created from an array of objects. The answer to the following question depend on the previous one.

How, and indeed how to do to be able to manage variants in a large number ve questions?

let arr = [

 { 'Выберите1': [
'First',
'Second'
],

 'Выберите2': [
'First',
'Second'
]
}
//and so on several objects
];

 parseArray(l) {
 let item = ";
 for(let key in l) {
 let data = l[key];

 item += typeof data === 'string' ? `<li class="item">${data}</li>` : 
 `<div class="select">
 <button class="btn" tabindex="1">${key}</button>
 <ul class="list">${this.parseArray(data)}</ul>
</div>`;
}

 return item;
 }
March 12th 20 at 08:12
2 answers
March 12th 20 at 08:14
You can add to each parameter dependentList, which will contain an array of options from a previous question. And if in the previous question chose the option from this list dependentList next question, the next question will be displayed. Or need depth for another two or more of the previous question?
@adrien.Orn69 Sorry, went to bed after the question)

I now understand that asking a stupid question due to a misunderstanding of the principles now roughly understand what you need. But the question still remains, how do such things at all? Really all you need to impose, and then the logic to implement? I overestimate the magic of programming? I'm not too lazy to write, just want to learn to do properly initially.

The depth of the questions, in my case, only one of the following. Homemade just select the option depends on the following select. - wilton_Ziemann commented on March 12th 20 at 08:17
March 12th 20 at 08:16
If I understand correctly the problem, you need to describe branching scenario selection. And dynamically render the next question after selection.

It is possible to describe the entire tree structure with multiple levels of nesting. Or come up with a semblance of addressing and add / remove the next question with options "address"; then the list will no attachments, flat.

There is not provided repeated clicks on the higher elements in the hierarchy. For good, they must remove all children of the sample.
fiddle

Find more questions by tags JavaScript