Filtering repeater using list of values from multi-select

I have a multi-selection group of checkboxes. I can print out the boxes that are checked

var listCateg = $w("#categoriebox").value

Printing listCateg gives me for instance: [“Economy”, “Philosophy”]

I’m trying to filter out my collection if any of the strings in the list above are found in a field of my collection (called themes).

I can filter out fine using 1 value:

$w("#dataset1").setFilter(wixData.filter()
      .contains("themes", listCateg[0]));

This gives me all the books that are about economy.

I can also filter out fine using 2 values:

$w("#dataset1").setFilter(wixData.filter()
      .contains("themes", listCateg[0])
      .or(wixData.filter().contains("themes", listCateg[1])
      )
  )

This gives me all the books that are about economy or those that are about philosophy.

However, I can’t seem to be able to filter using all strings in my list, i.e. something like:

$w("#dataset1").setFilter(wixData.filter().hasSome("themes", listCateg));

Can anyone tell me how to filter a repeater’s output using all values found in a list?

Thanks a lot

I got it. In case it helps out anyone else, I did it like so.

export function categoriebox_change(event) {
 
 var listCateg = $w("#categoriebox").value

 if (listCateg.length == 1){
 var filter = wixData.filter().contains("themes", listCateg[0])
  }

 else if (listCateg.length > 1) {
    filter = wixData.filter().contains("themes", listCateg[0])
    for (let i = 1; i < listCateg.length; i++)
      filter = filter.or(wixData.filter().contains("themes", listCateg[i]))
    }

 else
    filter = wixData.filter()

  $w("#dataset1").setFilter(filter);
}