title: Adding and removing an array to local storage, then retrieving the individual array items somehow?
body: <p>I'm working on a library that the user can add and remove books to. This requires local storage. I successfully added the library to local storage but I have no idea how to access and modify the individual local storage array items.</p>
  <p>I have a function to add new books to the library and then send the library to local storage:</p>
  <pre><code>    const addBook = (e) =&gt; {
      e.preventDefault();
      let newBook = createBook();
      updateLibrary(newBook);
  
      newBook = `${newBook.title}`;
      console.log(newBook);
  
      localStorage.setItem('library', JSON.stringify(theLibrary));
      
      newBookForm.style.display = 'none';
  
      
  }
  </code></pre>
  <p>Then, I set the library to be displayed to the user equal to the library from local storage:</p>
  <pre><code>// Displays the library on cards
  function showLib() {
      for (let i = 0; i &lt; theLibrary.length; i++) {
              
              if (localStorage.length &gt; 0) {
                  let library = JSON.parse(localStorage.getItem('library'));
  
                  theLibrary = library;
  
              }
              
  
  </code></pre>
  <p>Now, that all works and what not but I can't figure out how to remove a specific item from an array within local storage. Here's my attempt at a solution within my remove button click function:</p>
  <pre><code>toggleRemove.onclick = function(e) {
                  console.log(e.target.parentNode);
                  deleteThis = e.target.parentNode;
  
                  for (i = 0; i &lt; theLibrary.length; i++) {
                      let library = JSON.parse(localStorage.getItem('library'));
                      console.log(library[i]);
                      let newLibrary = library.splice(i, 1);
                      localStorage.setItem('remove', JSON.stringify(newLibrary));
  
                      localStorage.removeItem(newLibrary);
  
                  }
  
                  
                  deleteThis.remove();
                  removeBook(deleteThis);
                  }
  </code></pre>
  <p>I'm banging my head against the wall here. I can't seem to target the item I want. Any help is appreciated thanks!</p>