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

Function removeFromCart

2-copy-of-code/lesson-14/data/cart.js:38–50  ·  view source on GitHub ↗
(productId)

Source from the content-addressed store, hash-verified

36}
37
38export function removeFromCart(productId) {
39 const newCart = [];
40
41 cart.forEach((cartItem) => {
42 if (cartItem.productId !== productId) {
43 newCart.push(cartItem);
44 }
45 });
46
47 cart = newCart;
48
49 saveToStorage();
50}

Callers 1

checkout.jsFile · 0.90

Calls 1

saveToStorageFunction · 0.70

Tested by

no test coverage detected