1. HTML 세팅하기

#screen {
     width: 300px;
     height: 200px;
     text-align: center;
     user-select: none;
}
#screen.waiting {
     background-color: aqua;
}
#screen.ready {
     background-color: Red;
     color: white;
}
#screen.now {
     background-color: greenyellow;
}

2. 클릭해서 화면 전환하기

$screen.addEventListener('click', (event) => {
    if (event.target.classList.contains('waiting')) {
           $screen.classList.remove('waiting');
           $screen.classList.add('ready');
					$screen.textContent = '초록색이 되면 클릭하세요';
          setTimeout(function(){
             $screen.classList.remove('ready');
             $screen.classList.add('now');
             $screen.textContent = '클릭하세요!';
          }, Math.floor(Math.random() * 1000) + 2000);
   } else if(event.target.classList.contains('ready')) {
                
   } else if(event.target.classList.contains('now')) {
               
   }
});

3. 반응 속도 측정하기

4. 평균 구하기

5. 성급한 선택 막기

else if(event.target.classList.contains('ready')) {
    clearTimeout(timeoutId);
    $screen.classList.remove('ready');
    $screen.classList.add('waiting');
    $screen.textContent = '너무 성급하시네요!';
}