HTML (index.html):
: Div jo question ko display karta hai, options ke container ke saath.
: Heading element jismein current question display hota hai.
: Div jismein options ke buttons display hote hain.
: Button jo next question ko display karta hai ya quiz ko restart karta hai.
: Paragraph element jo user ka score display karta hai.
CSS (styles.css):
.container, .question-container: Styling for the main container and question container divs.
h1: Styling for the question display heading.
.options, .option: Styling for the options container and option buttons.
.correct, .wrong: Styling for the correct and wrong answer buttons.
button: Styling for the next button.
JavaScript (script.js):
fetchQuestions(): Function to fetch random questions from the API.
displayQuestion(): Function to display the current question and options.
checkAnswer(): Function to check the correctness of the selected answer and update the score.
updateScore(): Function to update the displayed score.
disableOptions(): Function to disable option buttons after an answer is selected.
nextButton.addEventListener('click'): Event listener to handle the functionality of the next button.
Yeh sabhi elements aur functionality milke ek quiz application banate hain jo users ko general knowledge ke sawal jawab karne ki suvidha pradan karta hai, saath hi unka score track karta hai.
Top comments (0)