title: How to link shopping cart array with products array?
body: <p>Here I have <strong>array of products</strong> which is <strong>add products to basket</strong>. 
  How can I remove certain <strong>product</strong> from array after I added it to <strong>basket</strong> by <strong>ID</strong>?</p>
  
  <pre><code>  //Product class
      function Product(options) {
        this.id = options.id;
        this.name = options.name;
        this.cost = options.cost;
        this.quantity = options.quantity;
        this.shortDescription = options.shortDescription;
        this.fullDescription = options.fullDescription;
      }
  
  //Basket class
  function Cart() {
    this.items = [];
  }
  
  //Add product in basket
  Cart.prototype.addItem = function(options) {
    //If we find the same element in array by name, just +1 to quantity in basket
    options.quantity = 1;
    for (var i in this.items) {
      if (this.items[i].id === options.id) {
        this.items[i].quantity += options.quantity;
        return;
      }
    }
    var item = new Product(options);
    this.items.push(item);
  };
  
  
  var arrayOfProducts = [
    {id:1, name:'book', cost:5.45, quantity:5, shortDescription: 'Short description about book', fullDescription: 'Full description about book'},
    {id:2, name:'pan', cost:7.31, quantity:2, shortDescription: 'Short description about pan', fullDescription: 'Full description about pan'},
    {id:3, name:'cup', cost:9.37, quantity:4, shortDescription: 'Short description about cup', fullDescription: 'Full description about cup'},
  ]
  
  cart.addItem(arrayOfProducts [0]);
  cart.addItem(arrayOfProducts [0]);
  cart.addItem(arrayOfProducts [1]);
  </code></pre>
  
  <p>We will see this in the array of Cart</p>
  
  <pre><code>id:1, name:book, cost:5.45, quantity:2, short description: Short description about book, full description: Full description about book
  ,id:2, name:pan, cost:7.31, quantity:1, short description: Short description about pan, full description: Full description about pan
  </code></pre>