Build a Music Instrument Filter - Step 12

Tell us what’s happening:

I am getting desired result but this step failing, please guide me to fix, what I may be missing.

Your code so far

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

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

function instrumentCards(instrumentCategory) {
  const instruments =
    instrumentCategory === "all"
      ? instrumentsArr
      : instrumentsArr.filter(
          ({ category }) => category === instrumentCategory
        );
  
  let finalString = "";
  let finalArr = [];
  let instrument = "";
  let price = "";
  for(let i = 0; i < instruments.length; i++) {
    instrument = instruments[i].instrument;
    price = instruments[i].price;
    finalString = `<div class="card"><h2>[${instrument}]</h2><p>$[${price}]</p></div>`;
    finalArr.push(finalString);
  }
  return finalArr
}

console.log(instrumentCards("all"));
console.log(instrumentCards("brass"));

// User Editable Region
/* file: styles.css */

Your browser information:

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

Challenge Information:

Build a Music Instrument Filter - Step 12

@mr-aakash You currently have <h2>[${instrument}]</h2> and <p>$[${price}]</p> for your finalString. Are you sure that you need the brackets there?

Thank you very much, I missed that after copying from instruction. And later my eyes were missing it. Thanks a lot :slight_smile:

1 Like