title: Storing multiple ID's in localStorage using JavaScript
body: <p>I am wanting to add a favorites function for my website. The technologies I am using are html, css, javascript and json. I am loading the json file thru ajax. A user is able to search for a device and add that device to their favourites and that is done via sessionStorage and localStorage, but my problem is when a user clicks on a new phone to add to their favorite, it overrides it. Do I have to put like an IF statement which will say if there is an id there still add this one. I am confused on how to do this...</p>
  
  <p>Code Samples....</p>
  
  <pre><code>$(document).on('click', '.productfavourite', function(event) { 
  
    // whichever HTML element has been clicked,
    // grab the id of that and set it as product fave
    productFave = event.target.id;
  
    localStorage.setItem('productFave', productFave);
    console.log(productFave);
    window.location="favourites.html";
  });
  </code></pre>