<html>
<body>
<h1>Keyboard Events</h1>
<h2>The which Property</h2>
<p>Press the Escape/Esc key on the keyboard (usually in the top left corner) in the input field, to alert some text.</p>
<input type="text" size="50" onkeydown="myFunction(event)">
<script>
function myFunction(event) {
let x = event.which || event.keyCode;
if (x == 27) {
alert ("You pressed the Escape key!");
}
}
</script>
</body>
</html>