Step 29 build a shopping cart not passing

hi, totally blind and using a screen reader jaws 2026. windows 11 pro. google chrome. now doing step 29, and it will not pass. is it my code, or a fcc querk or bug or something else, can you help me out? tried rewriting the code a few times and yes trying my best. did research online and did look at some code. so it looks almost the same and or similar. so if i am missing anything or not getting it right, then let me know. how to get this to pass. marvin.
ps: pasting my code and the error below.

javascript:
You should remove the undefined from your falsy expression.

link to the step:

.

1 Like

Hi. Can you please post your code for the step.

hi. sorry, my fault. should have double checked. so heres my vs code below.
marvin.

java script:const cartContainer = document.getElementById("cart-container");

const productsContainer = document.getElementById("products-container");

const dessertCards = document.getElementById("dessert-card-container");

const cartBtn = document.getElementById("cart-btn");

const clearCartBtn = document.getElementById("clear-cart-btn");

const totalNumberOfItems = document.getElementById("total-items");

const cartSubTotal = document.getElementById("subtotal");

const cartTaxes = document.getElementById("taxes");

const cartTotal = document.getElementById("total");

const showHideCartSpan = document.getElementById("show-hide-cart");

let isCartShowing = false;



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 Macarons (5 Pack)",

    price: 11.99,

    category: "Macaron",

  },

  {

    id: 12,

    name: "Lemon Cupcakes (4 Pack)",

    price: 12.99,

    category: "Cupcake",

  },

\];



products.forEach(({ name, id, price, category }) => {

  dessertCards.innerHTML += \`

    <div class="dessert-card">

      <h2>${name}</h2>

      <p class="dessert-price">$${price}</p>

      <p class="product-category">Category: ${category}</p>

      <button id="${id}" class="btn add-to-cart-btn">Add to cart</button>

      <span id="product-count-for-id${id}"></span>

    </div>

  \`;

});



    

 

class ShoppingCart {

  constructor() {

    this.items = \[\];

    this.total = 0;

    this.taxRate = 8.25;

  }



addItem(id, products) {

  const product = products.find((item) => item.id === id);

  this.items.push(product);



  const totalCountPerProduct = {};

  this.items.forEach((dessert) => {

    totalCountPerProduct\[dessert.id\] = (totalCountPerProduct\[dessert.id\] || 0) + 1;

  });



  const currentProductCount = totalCountPerProduct\[product.id\];

  const currentProductCountSpan = document.getElementById(\`product-count-for-id${id}\`);



  // Falsy expression for Step 29

  currentProductCount > 1

    ? currentProductCountSpan.textContent = \`${currentProductCount}x\`

    : productsContainer.innerHTML += \`<div class="product" id="dessert${id}"></div>\`;

}

chat later..

Hi. You have 4 forward slashes in your true and false expressions in your ternary statement. If you remove those it should pass. (forward slash: \)

currentProductCount > 1

    ? currentProductCountSpan.textContent = \`${currentProductCount}x\`

    : productsContainer.innerHTML += \`<div class="product" id="dessert${id}"></div>\`;

}