Q{index + 1}.
{ const newLength = questions.v[index].answers.length; const currentAnswers = questions.v[index].answers; if (newLength > currentAnswers.length) { // Add more answers while (questions.v[index].answers.length < newLength) { questions.v[index].answers.push(""); } } else if (newLength < currentAnswers.length) { // Remove excess answers questions.v[index].answers = currentAnswers.slice(0, newLength); } }} class="h-fit rounded-xl bg-gray-800 p-1 text-center text-white" >
Options
{#each Array(7) as _, i}
{i + 2}
{/each}
{#each questions.v[index].answers as _, answersIndex}
{/each}