title: Best way to save javascript data in localstorage
body: <p>I want to be able to create JavaScript note objects and dynamically delete them using a navbar pane.</p>
  
  <pre><code>var sel = window.getSelection();
  var range = sel.getRangeAt(0);
  var editor = { "startContainer": range.startContainer, "startOffset": range.startOffset, "endContainer": range.endContainer, "endOffset": range.endOffset };
  </code></pre>
  
  <p>Then using a message I would pass the location and message into a function to add notes:</p>
  
  <pre><code>Notes(editor, message);
  function Notes(location, note) {
    this.location = location;
    this.note = note;
  }
  </code></pre>
  
  <p>I'm trying to wrap my brain around how to actually save the data locally.</p>
  
  <pre><code>function addNote() {
    // if(tyepof(Storage) !== "undefined"){
    //   if(localStorage.notes){
    //     localStorage.notes
    //   } else {
    //     localStorage.notes = 
    //   }
  
    localStorage.setItem()
  }
  </code></pre>
  
  <p>Is localStorage the way to go? I know sessionStorage only stores for a session. </p>