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