Skip to content

This project is a simple JavaScript quiz game that runs using prompt() and alert(), but is triggered through an HTML button instead of starting automatically. It demonstrates the use of core JavaScript concepts such as arrays, loops, conditionals, functions, input handling, and external JS linking.

Notifications You must be signed in to change notification settings

open5nippet/JavaScript-quiz-game-4

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

3 Commits
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ“˜ JavaScript Console Quiz Game

This project is a simple interactive quiz built with HTML and JavaScript. The quiz runs through browser prompt() and alert() dialogs, and it only starts when the user clicks a Start Quiz button on the webpage. It showcases fundamental JavaScript concepts such as arrays, loops, functions, conditionals, and external script linking.

๐Ÿš€ Features

Quiz runs inside browser pop-up prompts and alerts

Starts only when the Start Quiz button is clicked

Answers are checked in a case-insensitive and trimmed manner

Real-time feedback after each question

Total score displayed at the end

Neat separation of HTML and JS logic using an external file

Uses an organized array of objects for questions and answers

๐Ÿ“‚ Project Structure Quiz-Game/ โ”‚ โ”œโ”€โ”€ index.html # UI with Start Quiz button (links to JS) โ”œโ”€โ”€ script.js # Main quiz logic โ””โ”€โ”€ README.md # Project documentation

๐Ÿ“ How to Run

Open index.html in any web browser

Click the Start Quiz button

Answer the questions shown in the prompts

Receive immediate feedback after each response

View your final score in a summary alert

๐ŸŽฏ What You Learn

By working on this project, you practice and understand:

Storing multiple questions using arrays

Using objects to pair questions with answers

Looping through questions with a for loop

Organizing code using a function (runQuiz)

Handling user input using prompt()

Displaying output using alert()

Normalizing text with:

toLowerCase()

trim()

Checking correctness using ifโ€“else conditions

toLowerCase()

trim()

Checking correctness using ifโ€“else conditions

Author:-

Ayush Kumar

About

This project is a simple JavaScript quiz game that runs using prompt() and alert(), but is triggered through an HTML button instead of starting automatically. It demonstrates the use of core JavaScript concepts such as arrays, loops, conditionals, functions, input handling, and external JS linking.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published