Javascript Detect Escape Key

document.addEventListener('keydown', function(event){
	if(event.key === "Escape"){
		//do something
	}
});
Friendly Hawk