title: Getting all items of one group from WebStorage
body: <p>I want to implement simple shopping cart system on my site using WebStorage. Items are pictures with <em>format</em> and <em>amount</em> values. There is a counter value which contains the number of items available in the storage at the moment and each new item is added to WebStorage in this format:</p>
  
  <pre><code>item&lt;id&gt; = 1:3,5
  </code></pre>
  
  <p>Now I have a problem with listing items from the storage. For example, if user buys 5 items and removes <code>item0</code> and <code>item3</code> (<code>item -= 2</code>), I wouldn't be able to get all the values with simple for loop even if I check if element exists in storage:</p>
  
  <pre><code>var len = parseInt(localStorage.getItem("items"));
  for (let i = 0; i &lt; len; i++) {
      if (localStorage.getItem("item" + i)) {
          // show element on the page
      }
  }
  </code></pre>
  
  <p>Len will be three, but I'll still have the <code>item5</code> which wouldn't be showed. </p>
  
  <p>Should I make new array of items' ID and remove ID's as items are deleted from page or there's a better way to deal with this?</p>