only triggers soon as when fingers press down the key
only triggers action when fingers are continuously on the key
only triggers action when lift figers off keyboard
document.addEventListner('keydown',function(){});
document.addEventListner('keypress',function(){});
document.addEventListner('keyup',function(){});
if (e.key === 'Escape' && !modal.classList.contains('hidden')) {
//if modal class does not contains hidden class close the modal (inverted boolean by using '!')
closeModal();
}
//같은 기능을함
if (e.key === 'Escape') {
if (!modal.classList.contains('hidden')) {
closeModal();
} }