im writting a ShoppingCart class to add and remove items from the cart code is meant to add and remove items from the shopping cart.
class ShoppingCart{
constructor(){
this.total = 0;
this.items = {};
}
addItems(itemName, quantity, price){
this.itemName = itemName;
this.quantity = quantity;
this.price = price;
this.cost = this.quantity * this.price;
this.total += this.cost;
this.items['itemName'] = this.itemName;
this.items['quantity'] = this.quantity;
}
removeItems(itemName, quantity, price){
this.itemName = itemName;
this.quantity = quantity;
this.price = price;
this.cost = this.quantity * this.price;
this.total -= this.cost;
delete this.items['itemName', 'quantity'];
}
}