function updateBooks(event) {
  let bookNode = event.target.parentNode;
  let title = bookNode.querySelector("h3").textContent;

  let targetIndex = myLibrary.findIndex((book) => book.title === title);

  myLibrary.splice(targetIndex, 1);

  localStorage.setItem("myLibrary", JSON.stringify(myLibrary));
  displayStatistics();
  displayShelf();
}
// function that dynamically updates library whenever element is removed
function that dynamically updates library whenever element is removed
function that dynamically updates library whenever element is removed
function updateBooks(event) {
  let bookNode = event.target.parentNode;
  let title = bookNode.querySelector("h3").textContent;
  let targetIndex = myLibrary.findIndex((book) => book.title === title);
  myLibrary.splice(targetIndex, 1);
  localStorage.setItem("myLibrary", JSON.stringify(myLibrary));
  displayStatistics();
  displayShelf();
}
function updateBooks ( event ) { let bookNode = event . target . parentNode ; let title = bookNode . querySelector ( "h3" ) . textContent ; let targetIndex = myLibrary . findIndex ( ( book ) => book . title === title ) ; myLibrary . splice ( targetIndex , 1 ) ; localStorage . setItem ( "myLibrary" , JSON . stringify ( myLibrary ) ) ; displayStatistics ( ) ; displayShelf ( ) ; }
function that dynamically updates library whenever element is removed
function that dynamically updates library whenever element is removed