Build a Music Instrument Filter Step 11

Hello,

I managed to get this working in the more longwinded if/else way, but I liked the simpler ternary way fCC does it.

I can’t get my head around the code though, specifically last funcion. Can someone tell me what is happening here? For some reason I can never get my head around the filter() method.

function instrumentCards(instrumentCategory) {
  const instruments =
    instrumentCategory === "all"   //ternary replaced the if conditional
      ? instrumentsArr             //true then instruments = instrumentsArr
      : instrumentsArr.filter(     //false then filter the instrumentsArr
          ({ category }) => category === instrumentCategory   // but what is happening here? I don't understand the ({category}) syntax. 
        );  

  return instruments;

do you know what filter does?