Your basket is currently empty!
// Define the product details
const product = {
id: 123,
name: 'Sample Product',
price: 19.99,
};
// Function to add the product to the shopping cart
function addToCart(product) {
// Placeholder logic for adding the product to a shopping cart
let cart = []; // Assuming this is your shopping cart array
cart.push(product);
console.log(`${product.name} added to cart`);
return cart;
}
// Call the function with the product details and update the page
const updatedCart = addToCart(product);
console.log("Updated Cart:", updatedCart); // This will log out the updated shopping cart array