JSFiddle - React, Tailwind, and code Playground

HTML

<span id="tempo">Donnez le focus Ă  cette frame, puis tapotez n'importe quelle touche</span>

JavaScript

var t = [];
var out = document.getElementById("tempo");
document.addEventListener("keydown", function() {
  t.push(performance.now());
  if (t.length > 1) {
    out.innerHTML = 60000 / (t[t.length - 1] - t[0]) * (t.length - 1);
  }
  if (t.length > 4) {
    t.shift();
  }
})