MCPcopy Create free account
hub / github.com/SuperSimpleDev/javascript-course / removeFromCart

Function removeFromCart

2-copy-of-code/lesson-15/data/cart.js:41–53  ·  view source on GitHub ↗
(productId)

Source from the content-addressed store, hash-verified

39}
40
41export function removeFromCart(productId) {
42 const newCart = [];
43
44 cart.forEach((cartItem) => {
45 if (cartItem.productId !== productId) {
46 newCart.push(cartItem);
47 }
48 });
49
50 cart = newCart;
51
52 saveToStorage();
53}
54
55export function updateDeliveryOption(productId, deliveryOptionId) {
56 let matchingItem;

Callers 1

renderOrderSummaryFunction · 0.90

Calls 1

saveToStorageFunction · 0.70

Tested by

no test coverage detected