title: How to update localstorage object value from index and key
body: <p>I need this solution for my project. its very important for me.
  i want to update object value with key and index, from local storage
  FOR
  my cart application. </p>
  
  <p>(Decrease button for product quantity in cart)</p>
  
  <p>Exmp.</p>
  
  <pre><code>function decreaseQuantity(index) {
    var oldQty = localStorage.cart[index].quantity;
    var newQty = oldQty - 1;
    localStorage.setItem(cart[index].quantity, newQty);
  }
  </code></pre>