There is some site.
And there is an action that must be triggered if the Escape button has been pressed.
We need the document object and the addEventListener method to subscribe to the keyup event.
In the event handler we check the key.
If the key is Escape we call the action.
That’s all.
Let’s press the Escape button.
The escape button has been pressed.