Build a Music Instrument Filter - Step 11

Tell us what’s happening:

I’m getting the expected output but this keeps on showing: When you change the selected category from the dropdown menu, you should log the result of instrumentCards(selectContainer.value) to the console. :confused::confused:

Your code so far

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

/* file: styles.css */

/* file: script.js */
// User Editable Region
let filteredArr = []
 if(instrumentCategory === "all"){
   return  filteredArr = [...instrumentsArr]
 } 
for(let i = 0; i < instrumentsArr.length; i++){
 if(instrumentsArr[i]["category"] === instrumentCategory){
  filteredArr.push(instrumentsArr[i])
 }
}
return filteredArr
}

selectContainer.addEventListener("change", () => {
  console.log(instrumentCards(selectContainer.value));
// User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/154.0.0.0 Mobile Safari/537.36

Challenge Information:

Build a Music Instrument Filter - Step 11

GitHub Link: freeCodeCamp/curriculum/challenges/english/blocks/workshop-music-instrument-filter/67213641373a23696b74424b.md at main · freeCodeCamp/freeCodeCamp · GitHub

I already figured it out :grin:

do not create a new array here, return the one you already have