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

Function removeFromCart

2-copy-of-code/lesson-16/data/cart.js:47–59  ·  view source on GitHub ↗
(productId)

Source from the content-addressed store, hash-verified

45}
46
47export function removeFromCart(productId) {
48 const newCart = [];
49
50 cart.forEach((cartItem) => {
51 if (cartItem.productId !== productId) {
52 newCart.push(cartItem);
53 }
54 });
55
56 cart = newCart;
57
58 saveToStorage();
59}
60
61export function updateDeliveryOption(productId, deliveryOptionId) {
62 let matchingItem;

Callers 1

renderOrderSummaryFunction · 0.90

Calls 1

saveToStorageFunction · 0.70

Tested by

no test coverage detected