Build a Music Instrument Filter - Step 11

Tell us what’s happening:

16
Step 11
Within your new function, you need to filter the instruments depending on the selected category.

Filter out items from instrumentsArr and make your function return an array containing the instrument objects with the same category of instrumentCategory. If instrumentCategory is equal to all, return the whole instrumentsArr array.

Then, remove the console.log from the callback of your event listener and log the result of calling instrumentCards with the selected option from the dropdo

Your code so far

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

/* file: styles.css */

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

function instrumentCards(instrumentCards) {
  if(instrumentCards==="all"){
    return instrumentsArr
  }else{
    instrumentsArr.filter(instruem => instruem.value===instrumentCards)
  }
}
selectContainer.addEventListener("change", () => {
  const selectCotagory = selectContainer.value
  console.log(selectCotagory)
});

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

Challenge Information:

Build a Music Instrument Filter - Step 11

You have changed the seed code so please reset this step and try again.