https://jay.codingcareerconnect.com/JavaScript-Quiz/Quiz.html
This HTML file creates a simple JavaScript quiz with four questions. It includes functionality to start the quiz, submit answers, and restart the quiz.
Here’s a summary of what the code does:
HTML Structure:
The file contains a basic HTML structure with a <div> for the quiz questions and buttons for starting, submitting, and restarting the quiz.
CSS Styling:
CSS styles are applied to center the content horizontally and vertically on the page, set the background image, and style the quiz container and buttons.
JavaScript Logic:
An array named questions holds objects representing each quiz question, including the question text, options, and correct answer.
The startQuiz function populates the quiz container with questions and options when the “Start Quiz” button is clicked. It hides the start button and shows the submit button while hiding the restart button.
The submitQuiz function calculates the score and displays an alert with the user’s score out of the total number of questions. If there are incorrect answers, it lists them along with the correct answers. It also displays the restart button.
The restartQuiz function resets the quiz by showing the start button, hiding the submit and restart buttons, and clearing the quiz container.
Overall, this code provides a basic framework for a JavaScript quiz application that allows users to answer questions, submit their answers, see their score, and restart the quiz.
