title: How to create a localStorage method
body: <p>I'm a bit confused about the <code>localStorage</code> object.
  <code>localStorage</code> is an object which obviously means that we can create methods, creating properties and such like an ordinary object.</p>
  
  <p>I'm trying to figure out how can i create a method inside <code>localStorage</code>.
  This is what I currently have:</p>
  
  <pre><code>localStorage = {
  firstname: function(){
          //get the firsname from the input and set it as the localstorage firsname
          $("#sublog").bind("click", function(){
          $("input[name='fName']").val();
          });
      },
      lastname: function(){
          //get the lastname from the input and set it as the localStorage lastname
          $("#sublog").bind("click", function(){
          $("input[name='lName']").val();
          });
      }
  };
  </code></pre>
  
  <p>My html looks like this:</p>
  
  <pre><code>&lt;div id="log"&gt;
      &lt;form&gt;
          &lt;input type="text" id="fName" name="fName" placeholder="FirstName" /&gt;
          &lt;input type="text" id="lName" name="lName" placeholder="LastName" /&gt;
          &lt;input type="submit" id="sublog" name="login" value="Login" /&gt;
      &lt;/form&gt;
  </code></pre>
  
  <p>To make it clear, I simply want to store the client's name to <code>localStorage.firstname</code> and <code>localStorage.lastname</code> when the client inserts his first and last name to save them.</p>