javascript e.key code example
Example 1: javascript e.key
document.inputDiv.addEventListener('keyup', (e) => {
console.log(e.key);
});
// Typing 'hello world' will log --> 'h' 'e' 'l' 'l' 'o' ' ' 'w' 'o' 'r' 'l' 'd';
Example 2: execute JS code after pressing space bar
document.body.onkeyup = function(e){
if(e.keyCode == 32){
//your code
}
}