JSFiddle - React, Tailwind, and code Playground

HTML

Click in the input box and press keys: <br/>
<input type="text" id="input" />
<pre id="output"></pre>

JavaScript

var input = document.getElementById('input');
var output = document.getElementById('output');

input.onkeydown = function(e) {
  var str = 'keydown --- code: ' + e.code + ', keyCode: ' + e.keyCode + ', key: ' + e.key;
  output.innerHTML = str + '\n' + output.innerHTML
}