document.addEventListener("keydown", function(event) { console.log(`Key pressed: ${event.key}`); // event.key is a string representing which key has been pressed });