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