Day-21 KeyBoard Action


keydown


only triggers soon as when fingers press down the key

keypress


only triggers action when fingers are continuously on the key

keyup


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();
  }  }