Trying to filter table where one row is an array

  javascript, react-table, reactjs

I’m building a searchbox for the filtering table using react-table. The table has a few properties, and one of them is an array.

Searchbox works pretty fine for each one row (name, id, label), but it crashes when I’m trying to search for the one property, which comes from array (colors).

Below is my search function. I’m getting the value from the input field.

function search(rows: any[]) {
    return rows.filter(
      (row) => > -1 || > -1 ||
      row.label.toLowerCase().indexOf(value) > -1 ||
      **row.colors.toLowerCase().indexOf(value) > -1** <- that doesn't work

It’d be great, if anyone could help me.


Source: Ask Javascript Questions