function popupFunctionality() {
  popupButton.addEventListener("click", showPopupForm);
  closeButton.addEventListener("click", closePopupForm);

  // when the user clicks anywhere outside of the modal, close it
  window.addEventListener("click", (event) => {
    if (event.target == popup) {
      popup.style.display = "none";
    }
  });
  // intercept submit event
  form.addEventListener("submit", (event) => {
    addBookToLibrary();
    closePopupForm();
    displayShelf();
    displayStatistics();
    form.reset();
    event.preventDefault();
  });
}
// function to contain all EventListeners and calls regarding popup visibility
function to contain all EventListeners and calls regarding popup visibility
function to contain all EventListeners and calls regarding popup visibility
function popupFunctionality() {
  popupButton.addEventListener("click", showPopupForm);
  closeButton.addEventListener("click", closePopupForm);
  window.addEventListener("click", (event) => {
    if (event.target == popup) {
      popup.style.display = "none";
    }
  });
  form.addEventListener("submit", (event) => {
    addBookToLibrary();
    closePopupForm();
    displayShelf();
    displayStatistics();
    form.reset();
    event.preventDefault();
  });
}
function popupFunctionality ( ) { popupButton . addEventListener ( "click" , showPopupForm ) ; closeButton . addEventListener ( "click" , closePopupForm ) ; window . addEventListener ( "click" , ( event ) => { if ( event . target == popup ) { popup . style . display = "none" ; } } ) ; form . addEventListener ( "submit" , ( event ) => { addBookToLibrary ( ) ; closePopupForm ( ) ; displayShelf ( ) ; displayStatistics ( ) ; form . reset ( ) ; event . preventDefault ( ) ; } ) ; }
function to contain all EventListeners and calls regarding popup visibility
function to contain all EventListeners and calls regarding popup visibility
// when the user clicks anywhere outside of the modal, close it // intercept submit event