title: Using localstorage to store login info
body: <p>I have been working on a project where we can store login info so that once a user registers, the data gets saved in the localStorage object. I have mentioned some javascript code to show that:</p>
  
  <pre><code>var user = document.getElementById("user");
  var pass = document.getElementById("pass");
  var email = document.getElementById("email");
  var user2 = document.getElementById("user2");
  var pass2 = document.getElementById("pass2");
  
  function register() {
      localStorage.setItem("username", user.value);
      localStorage.setItem("password", pass.value);
      localStorage.setItem("email", email.value);
      document.getElementById("id01").innerHTML = "Registration successful";
  }
  
  function login() {
      var checkuser = localStorage.getItem("username");
      var checkpass = localStorage.getItem("password");
      if (checkuser === user2.value &amp;&amp; checkpass === pass2.value) {
          document.getElementById("demo").innerHTML = "You are now logged in.";
      } else {
          document.getElementById("demo").innerHTML = "Incorrect username and password";
      }
  }
  </code></pre>
  
  <p>In the javascript code mentioned above, i have used the <code>localStorage</code> object to store the values. I have  stored the username in a <code>user</code> property, the password in a <code>pass</code> property and the email in an <code>email</code> property. </p>
  
  <p>My question is: Is there any way where we can store the username, password and the email in one property(<code>user</code> property)? </p>