Build a Shopping Cart - Step 11

Tell us what’s happening:

The test wants me to give the h2 the text of the name variable. I don’t know if that means name.text, or name in an attribute of h2, or what. Please help me understand what the text of name is.

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></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/134.0.0.0 Safari/537.36

Challenge Information:

Build a Shopping Cart - Step 11

Looks like name is a parameter being passed to a function in this context, right? So, how would you write name there to access its value? Remember, you’re coding inside a template literal.

1 Like

Oh, I understand! Thank you so much. This really helped.

innerHTML means you’ll be writing HTML but the template literal means you can interpolate variables within the string. :+1:

Yeah, I got the innerHTML and the template literal ( ${} ) mixed up.

1 Like