Quiz App in JavaScript
Ten hard questions on JavaScript, and an engine that knows nothing about them.
- JavaScript
- CSS
- HTML
About this project
A multiple-choice quiz: one question at a time, immediate feedback with the reason, a progress bar, an optional timer, and a review of everything you got wrong at the end.
The questions are ten real ones about JavaScript — the temporal dead zone, microtask ordering, shallow copies, and why indexOf(NaN) never finds anything. They are not warm-ups, and each one explains itself after you answer.
The design idea is that the data is not the program. script.js is in two parts and the line between them is the whole project: one object holds the quiz and contains no DOM calls at all, while the engine below it knows only eight field names. Read the engine end to end and you will not learn a single fact about JavaScript. That ignorance is the feature — swap the array and you have a history quiz, a Python quiz or a driving-theory quiz, with no other change.
What you will learn
- Separate data from the program that renders it, so swapping the content changes nothing else
- Shuffle options without losing track of which one is correct
- Validate your data at startup and fail with a readable message rather than a blank page
- Build a per-question timer that cannot leak an interval into the next question
- Render a review screen that explains the answers rather than just scoring them
Before you start
- JavaScript basics — arrays, objects and functions
- A browser and a text editor. Nothing to install.
New to JavaScript? The free JavaScript course covers everything this project assumes.
Academic integrity notice
These projects are provided for learning, experimentation and reference. Understand the code, modify it for your own requirements, and acknowledge external work according to your institution’s academic policies. Priodemy does not supply work to be submitted as your own.
Features
- Ten genuinely difficult questions on JavaScript fundamentals, each with an explanation
- Questions and options both shuffled, with the correct answer tracked through the shuffle
- Optional per-question timer that expires cleanly
- Startup validation that reports what is wrong with your data instead of rendering a blank page
- End-of-quiz review of every question you missed
- Options work with any number of choices, not just four
Technology stack
Track: Web Development · Level: Starter
What is included
- index.html, style.css and script.js — commented throughout
- A README on the data/engine split and the four places it would have quietly broken
- Suggested extensions, including loading questions from JSON and a category filter
Delivered as a 18 KB ZIP. SHA-256 published under Changelog so you can verify it.
System requirements
- Operating system
- Any
- Runtime
- Any modern browser. No install, no build step.
Licence
Learn from it, change it, and use it in your own coursework and personal projects. Do not resell it or pass it off as your own original work.
- Personal and educational use
- Modifying the code however you like
- Using it as the basis of your own coursework, with honest acknowledgement
- Putting your modified version in a portfolio or on your own GitHub
- Reselling or redistributing the project, modified or not
- Presenting it as your own original work
- Commercial deployment — see the Commercial licence
Support window: 6 months from download.
Frequently asked
Can I use my own questions?
That is the point of the design. Replace the QUIZ object at the top of script.js and nothing below it changes. If your data has a mistake in it, the app tells you which question and which field rather than failing silently.
Why shuffle the options at all?
Because an answer stored as an index breaks the moment you reorder anything, and it is the most common bug in quiz projects. The README covers the fix: convert the index to the actual option value before shuffling, so the correct answer travels with the option rather than with its position.
Are the ten questions actually correct?
Yes — each one was executed rather than assumed, including the microtask ordering question and the shallow-copy question. The explanations name the runtime where behaviour differs between browsers and Node.
Changelog
- First release
SHA-25642928afb1b607dd846a1eb7257d78ab5f9a8e6466d79607018d14e9049bf1988