Learn Basic OOP by Building a Shopping Cart - Step 12

Tell us what’s happening:

What could be the problem with my code at this point?

Your code so far

<!-- file: index.html -->

/* file: styles.css */

/* file: script.js */
// User Editable Region

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>

      </div>
    `;
  }
);

// User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36

Challenge Information:

Learn Basic OOP by Building a Shopping Cart - Step 12

Hi there!
You didn’t need to add quote marks around Category: . Remove it and your code will pass.

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>

      </div>
    `;
  }
);

this still doesnt pass

i cannot see your code correctly. because you did not posted your code properly within back ticks.

Is there an error or hint?

I’ve edited your code for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (').

in the above line, you have missing somthing. read the instruction carefully.
instructions:
create two p elements. Give the first a class of dessert-price , and the text of the price variable with a dollar sign in front of it.

I would double my dollars sign to and see what happen

$${example}

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.