timeoutId = setTimeout(function () {
          startTime = new Date();
          $screen.classList.replace('ready', 'now');
          $screen.textContent = '클릭하세요!';
        }, Math.floor(Math.random() * 1000) + 2000); // 2000~3000 
      } else if ($screen.classList.contains('ready')) { // 준비 화면
        clearTimeout(timeoutId); -------------------------- ①
        $screen.classList.replace('ready', 'waiting'); ---- ②
        $screen.textContent = '너무 성급하군요!'; --------- ③
      } else if ($screen.classList.contains('now')) { // 측정 화면
        endTime = new Date();
        const current = endTime - startTime; 
        records.push(current);
        const average = records.reduce((a, c) => a + c) / records.length;
        $result.textContent = `현재 ${current}ms, 평균: ${average}ms`; 
        startTime = null;
        endTime = null;
        $screen.classList.replace('now', 'waiting');
        $screen.textContent = '클릭해서 테스트를 시작하세요';
      }
    });
    신간 소식 구독하기
    뉴스레터에 가입하시고 이메일로 신간 소식을 받아 보세요.