"Investigation Checklist: n Options for Solving Javascript Unsorted Issues"
P粉512526720
P粉512526720 2023-09-10 20:24:03
0
1
447

I'm currently trying to create a questionnaire for a website where I have a certain number of questions and a certain number of answers. But now I need to change the number of answers to different values ​​(instead of 4, but 2, 3, 5, etc.). I know nothing about website development.

Initially, I have an unsorted list:

question.innerHTML = `<h2>Q${count + 1}. ${questions[count].question}</h2>
<ul class="option_group">
<li class="option">${first}</li>
<li class="option">${second}</li>
<li class="option">${third}</li>
<li class="option">${fourth}</li>
</ul>`;

Before this, I used:

let[first, second, third, fourth] = questions[count].options;

to display options. I considered using an array to count each element of the options provided and change it for each question, but I can't seem to find the correct way to form the command. Thanks in advance for any advice!

P粉512526720
P粉512526720

reply all(1)
P粉060528326
let html = `<h2>Q${count + 1}. ${questions[count].question}</h2>
<ul class="option_group">`
for (let item of questions[count].question) {
  html += `<li class="option">${item}</li>`
}
html += '</ul>'
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template