Menu

1 / 2

How to Measure Reaction Time Without Counting the Waiting Period

DEV Community: vue·Joe Lin·about 22 hours ago
#L44tSlD5
#devtovue#devto#dev#value#result
Reading 0:00
15s threshold

A reaction-time test becomes unfair if it measures how long the screen waited before turning green. I built the test as a small state machine: idle, waiting, ready, result, and early. The timer starts only when the ready state begins, so the result represents the click-to-signal interval rather than the random delay.

Random delay prevents anticipation

Starting a round chooses a delay between 1.2 and 4 seconds:

function startWaiting () { phase . value = " waiting " ; const delay = 1200 + Math . random () * 2800 ; clearWait (); waitTimer = setTimeout (() => { phase . value = " ready " ; startTime = performance . now (); }, delay ); }

Enter fullscreen mode

Exit fullscreen mode

The random interval makes memorizing a fixed countdown less useful.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.