title: Why I always get "Uncaught SyntaxError: Unexpected token u " from Chrome?
body: <p>I have spent a whole day on this, googling and searching for answers but still could not figure out.</p>
  
  <p>My code is a bit long and it works well in Firefox but gets  "Uncaught SyntaxError: Unexpected token u " from Chrome.</p>
  
  <p>Can anyone points me out where I am wrong? Thanks in advance!</p>
  
  <pre><code>// when the page loads, list all the current contacts
  $(document).ready(function(){
  
      // check if localStorage database exists
      if(!localStorage.getItem("customerDatabase")){
  
          // define a JSON object to hold all current address
          var contacts = {
              "users":[
                  {
                      "id":"1",
                      "name":"dennis",
                      "email":"dennisboys@gmail.com"
                  },
                  {
                      "id":"2",
                      "name":"zoe",
                      "email":"zoeisfemale@gmail.com"             
                  }
              ]   
          } // end of contacts JSON object
  
          // stringify the object 
          var stringObject = JSON.stringify(contacts);                
  
          // store it into localStorage database
          var storedDatabase = localStorage.setItem("customerDatabase", stringObject);                                            
  
      } else {
          // list all customers upon page loads
          listJSONCustomers();        
      }   
  
      // list all current contacts from JSON object in localStorage
      function listJSONCustomers(){
  
        var displayHTML = "";
        var i;
  
        // get the data from localStorage
        var storedDatabase = localStorage.getItem("customerDatabase");
  
        // parse the data from string to JSON object
        var parseObject = JSON.parse(storedDatabase); 
  
        // access the users key of the JSON object
        var userObject = parseObject.users;
  
        // get the length of the object (how many customers the database has)
        var contactsLength = userObject.length;     
  
        for(i=0; i&lt;contactsLength; i++){
            var trElement = '&lt;tr id="address' + (i+1) + '"&gt;';
            var tdId = '&lt;td id="id' + (i+1) + '"&gt;' + userObject[i].id + '&lt;/td&gt;';
            var tdName = '&lt;td id="name' + (i+1) + '"&gt;' + userObject[i].name + '&lt;/td&gt;';
            var tdEmail = '&lt;td id="email' + (i+1) + '"&gt;' + userObject[i].email + '&lt;/td&gt;';
            var tdButton = '&lt;td id="button"&gt;&lt;button id="editButton' + userObject[i].id + '"&gt;Edit&lt;/button&gt; | &lt;button id="deleteButton' + userObject[i].id + '"&gt;Delete&lt;/button&gt;&lt;/td&gt;';
  
            displayHTML += trElement + tdId + tdName + tdEmail + tdButton + '&lt;/tr&gt;';
        }     
  
        $('#address_list').html(displayHTML);           
      }       
  
      // add customer to database  
      $('#saveCustomer').click(function(){
  
         if( $('#customerName').val() !== "" &amp;&amp; $('#customerEmail').val() !== "" ){
  
             var customerName = $('#customerName').val();
             var customerEmail = $('#customerEmail').val();
  
             // get the data from localStorage
             var storedDatabase = localStorage.getItem("customerDatabase");
  
             // parse the data from string to JSON object
             var parseObject = JSON.parse(storedDatabase);    
  
             // access the users key of the JSON object
             var userObject = parseObject.users;     
  
             // get the new entry
             var newCustomerObject = {
                                    "id": userObject.length + 1,
                                    "name": customerName,
                                    "email": customerEmail
                                    };
  
             // push the new entry into the object                                                            
             userObject.push(newCustomerObject);
  
             // convert the object into string for localStorage
             var stringObject = JSON.stringify(parseObject);         
  
             // store the JSON object into localStorage
             var storedDatabase = localStorage.setItem("customerDatabase", stringObject);
  
             // list all customes again every time a database receives a new entry
             listJSONCustomers();     
  
         } else {
            alert("Please enter customer's name and email.");  
         }
  
      }); // end of $('#saveCustomer').click();
  
  
  });
  </code></pre>