- Game Title: Typing Speed Test
- Course: AMET | Frontend Web Development Basics – Lab
- Team Members:
- Darish Domma
- Sanjay U S
- Varun V S
The Typing Speed Test is a browser-based mini game where the player types randomly selected sentences as quickly and accurately as possible within a fixed 30‑second time limit. The game shows live statistics such as remaining time, Words Per Minute (WPM), and accuracy while the player types.
- Open
index.htmlin any modern web browser. - On the Start Screen, read the instructions and click Start Test.
- On the Game Screen, a sentence appears at the top; start typing it in the text area.
- Correct characters are highlighted in green and incorrect ones are underlined in red.
- When the timer reaches zero, the Result Screen displays your final WPM, accuracy percentage, and total characters typed.
- Click Play Again to restart the test or Home to return to the start screen.
- Clear game flow with three states: Start → Playing → Game Over.
- 30‑second countdown timer with live updates.
- Random sentence selection from a predefined array for each test run.
- Real-time visual feedback for correct and incorrect characters while typing.
- Live WPM and accuracy calculation shown during the game, plus detailed summary at the end.
- Responsive layout using simple CSS so the game works on both desktop and mobile screens.
-
Variables & Data Types
- Numbers:
timeLimit,timeLeft,charsTyped,mistakes - Strings:
currentSentence - Boolean:
isGameActive - Array:
const sentences = [ ... ]
- Numbers:
-
Operators & Conditionals
- Arithmetic operators for timer, character count, and WPM calculation.
- Relational/logical operators in statements like
if (timeLeft <= 0)andif (enteredText === currentSentence).
-
Loops & Functions
forloop to create<span>elements for every character in the sentence.- Multiple user-defined functions, including:
startGame()finishGame()updateTimer()calculateResults()handleTyping()switchScreen()pickRandomSentence()renderSentence()
-
Arrays / Objects
sentences[]stores several sentences for random selection.- Result object from
calculateResults()returns{ wpm, accuracy }.
-
DOM Manipulation
- Using
document.getElementById()andquerySelectorAll()to access elements. - Updating text and styles with
textContent,innerHTML, andclassListto show game state and feedback.
- Using
-
Event Handling & Timers
clickevents on buttons for starting, replaying, going home, and cancelling.inputevent on the text area to process typing in real time.setInterval()andclearInterval()used to implement the countdown timer.
- GitHub Repository:
https://github.com/HarishDomma/Harish_149_speed_test