title: How to store an array of objects in Local Storage?
body: <p>This is my code. I am trying since a couple of days to create an Array of Objects, which I will then store in Local Storage. Here is the problem, I need to first Get the existing value from Local Storage.</p>
  
  <p>I then need to add the new data object to the existing array. I then convert it into JSON so that I can store it back in the local storage.</p>
  
  <pre><code>onRegisterSubmit(){
      const user = {
          a: this.a,
          b: this.b,
          c: this.c,
        id: Date.now()
      }    
  
     var abc = [];
     var get =  JSON.parse(localStorage.getItem('user'));
     abc = [get];
     abc.push(user);
  
     localStorage.setItem('user', JSON.stringify(abc));
  
     console.log(JSON.stringify(abc));
     console.log(get);
    }
  </code></pre>
  
  <p>I want the JSON to be an array of objects like this,</p>
  
  <pre><code>[{"hour":1,"minute":21,"ampm":"PM","repeatDays":[],"message":"","todayOrTomorrow":"Tomorrow","isRepeatMode":false,"isEnabled":false,"id":"1493797882440"},{"hour":1,"minute":24,"ampm":"PM","repeatDays":[],"message":"","todayOrTomorrow":"Tomorrow","isRepeatMode":false,"isEnabled":false,"id":"1493797896257"},{"hour":6,"minute":14,"ampm":"PM","repeatDays":[],"message":"","todayOrTomorrow":"Tomorrow","isRepeatMode":false,"isEnabled":false,"id":"1493815470408"}]
  </code></pre>
  
  <p>This is my JSON.</p>
  
  <pre><code>[[[[[[[{"id":1493820594019},{"id":1493820606448}],{"id":1493820609111}],{"id":1493820610150}],{"id":1493820610553}],{"id":1493820610827}],{"id":1493820611015}],{"id":1493820612018}]
  </code></pre>
  
  <p>I've been trying for several days and any help will be greatly appreciated. </p>