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粉0605283262023-09-11 10:50:16
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>'