Tell us what’s happening:
Refernce error: Can’t find variable products
Why if I listed them separately?
const products = [
{
id: 1,
name: “Vanilla Cupcakes (6 Pack)”,
price: 12.99,
category: “Cupcake”,
},
{
id: 2,
name: “French Macaron”,
price: 3.99,
category: “Macaron”,
},
{
id: 3,
name: “Pumpkin Cupcake”,
price: 3.99,
category: “Cupcake”,
},
{
id: 4,
name: “Chocolate Cupcake”,
price: 5.99 ,
category: “Cupcake”,
},
{
id: 5,
name: “Chocolate Pretzels (4 Pack”,
price: 10.99,
category: “Pretzel”,
},
Your code so far
<!-- file: index.html -->
/* file: styles.css */
/* file: script.js */
// User Editable Region
const products = [
{
id: 1,
name: "Vanilla Cupcakes (6 Pack)",
price: 12.99,
category: "Cupcake",
},
{
id: 2,
name: "French Macaron",
price: 3.99,
category: "Macaron",
},
{
id: 3,
name: "Pumpkin Cupcake",
price: 3.99,
category: "Cupcake",
},
{
id: 4,
name: "Chocolate Cupcake",
price: 5.99 ,
category: "Cupcake",
},
{
id: 5,
name: "Chocolate Pretzels (4 Pack",
price: 10.99,
category: "Pretzel",
},
{
id: 6,
name: "Strawberry Ice Cream",
price: 2.99,
category: "Ice Cream",
},
{ id: 7,
name: "Chocolate Macarons (4 pack)",
price: 9.99,
category: "Macaron",
},
{
id: 8,
name: "Strawberry Pretzel",
price: 4.99,
category: "Pretzel"
},
{
id: 9,
name: "Butter Pecan Ice Cream",
price: 2.99,
category: "Ice Cream"
},
{
id: 10,
name: "Rocky Road Ice Cream",
price: 2.99,
category: "Ice Cream"
}
{
id: 11,
name: "Vanilla Macrons (5 pack)",
price: 11.99,
category: "Macron"
},
{
id: 12,
name: "Lemon Cupcakes",
price: 12.99,
category: "Cupcake",
}
];
// User Editable Region
Your browser information:
User Agent is: Mozilla/5.0 (iPad; CPU OS 18_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/133.0.6943.84 Mobile/15E148 Safari/604.1
Challenge Information:
Learn Basic OOP by Building a Shopping Cart - Step 7