manejar ESC Presione JS

//Check if the key is the Escape key, also known as 27 in the ASCII table
const pressEsc = (event) => {
	if(event.key === "Escape"){
    	console.log("You pressed Esc button")
    }
}

//Listen to the global keydown, the callback function will give us the wanted result
window.addEventListener("keydown", pressEsc)