To run:
npm install
npm run devGo to: http://localhost:5173/
File: src/questions.js
- Add two more question objects to the existing array.
File: src/App.svelte
- Add a new variable called
score - Inside the
handleAnswer()function, compare the selected choice with the correct answer - If it's correct, increment the score
- When the game ends, show the final score below the message
File: src/App.svelte
- Show an element that asks the player to enter their name before the game begins
- Use two-way binding (bind:value) to track the name
- Start the game when the user presses Enter, and hide the input
- Use the player's name to personalize the final score screen
File: src/App.svelte
- Add a button that appears when the game ends
- When clicked, reset
current,score, andshowScoreto their initial values to restart the game
File: src/App.svelte
- Add a countdown timer that resets with each new question
- Automatically skip to the next question if time runs out
Files: src/App.svelte, src/Question.svelte
- Use Svelte's built-in
transitionoranimatefeatures to add visual feedback - For example: show a flash of green for a correct answer, or red for an incorrect one
- You could also disable buttons briefly and show a short animation before moving to the next question