Algebra Practice
Quizzes

Algebra Practice Quiz

Algebra Practice Quiz

${q.question}
  • ${q.a}
  • ${q.b}
  • ${q.c}
  • ${q.d}
`; } function getSelected() { const answers = document.querySelectorAll('input[name="answer"]'); let answer; answers.forEach(ans => { if(ans.checked) answer = ans.value; }); return answer; } submitBtn.addEventListener('click', () => { const answer = getSelected(); if(!answer) { alert("Please select an answer!"); return; } if(answer === quizData[currentQuiz].correct) score++; currentQuiz++; if(currentQuiz < quizData.length) loadQuiz(); else { quiz.innerHTML = ''; submitBtn.style.display = 'none'; result.innerText = `You scored ${score} out of ${quizData.length}!`; } }); loadQuiz();