h
72
h
event.keyCode
72
event.key
h
event.code
KeyH
Unicode
n/a
Code Examples
Copy and paste these examples to detect the h key in your JavaScript code
Recommended modern approach
// Modern approach (recommended)
document.addEventListener('keydown', (e) => {
if (e.key === 'h') {
console.log('h key pressed!');
// Your code here
}
});Related Keys
Other keys commonly used together or in similar contexts