keycode keydown event keyboard code example
Example 1: javascript e.keycode deprecated
// Use e.key instead;
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: event.keyCode === 13
It's the [Return] or [Enter] key on keyboard.