How could i improve this Quiz in vue3
<script setup> const questions = ref([]); const init = () => { for (let i = 0; i < quizData.length; i++) { const q = quizData[i]; questions.value.push(new Questions(q.question, q.options, q.correctAnswer)); } }; init(); const currentIndex = ref(0); const selectedAnswer = ref(''); const score = ref(0); const finished = ref(false); const currentQuestion = computed(() => questions.value[currentIndex.value]); const progress = computed(() => ((currentIndex.value + 1) / questions.value.length) * 100); const selectAnswer = (answer) => { selectedAnswer.value = answer; }; const nextQuestion = () => { i
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.