Build a music instrument filter

Hello there !! I’m currently at test 14 and i don’t know why i cant get it. The issue is i really get the result with no commas but i don’t pass the test plus the styles of the result dont get styled ??? What can be the cause ??? Every card that is displayed after i click the menu sits below each other … thats it….

const instrumentsArr = [

{ category: “woodwinds”, instrument: “Flute”, price: 500 },

{ category: “woodwinds”, instrument: “Clarinet”, price: 200 },

{ category: “woodwinds”, instrument: “Oboe”, price: 4000 },

{ category: “brass”, instrument: “Trumpet”, price: 200 },

{ category: “brass”, instrument: “Trombone”, price: 300 },

{ category: “brass”, instrument: “French Horn”, price: 4300 },

{ category: “percussion”, instrument: “Drum Set”, price: 500 },

{ category: “percussion”, instrument: “Xylophone”, price: 3000 },

{ category: “percussion”, instrument: “Cymbals”, price: 200 },

{ category: “percussion”, instrument: “Marimba”, price: 3000 }

]

const selectContainer = document.querySelector(“select”);

const productsContainer = document.querySelector(“.products-container”);

function instrumentCards(instrumentCategory) {

const instruments =

instrumentCategory === "all"

  ? instrumentsArr

  : instrumentsArr.filter(

      ({ *category* }) => category === instrumentCategory

    );

return instruments.map(({instrument,price})=>{

return `

${instrument}

$${price}

`.trim();

}).join(“”);

}

selectContainer.addEventListener(“change”, () => {

productsContainer.innerHTML = instrumentCards(selectContainer.value);

});

Please post a link to the challenge

Please format your code so it’s readable. When you enter a code block into a forum post, please precede it with three backticks to make it easier to read.

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

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

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