Skip to content

Commit c319f60

Browse files
authored
duck typist: change wpm computation to the de facto standard (#242)
1 parent 77af8b0 commit c319f60

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

code/duck-typist.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ window.addEventListener('DOMContentLoaded', () => {
217217
const words = gLesson.querySelectorAll('.space').length + 1;
218218
const chars = gLesson.children.length;
219219
const cpm = Math.round(chars / elapsed);
220-
const wpm = Math.round(words / elapsed);
220+
const wpm = Math.round(cpm / 5);
221221
const prc = 100 - Math.round(1000 * errors / chars) / 10;
222222
gStatus.innerHTML = `${wpm} wpm, ${cpm} cpm <progress value="${cpm}" max="${MIN_CPM_SPEED}">${cpm}</progress>, ${prc} % <progress value="${prc}" max="${MIN_PRECISION}">${prc}%</progress>`;
223223

0 commit comments

Comments
 (0)