title: How to filter the entire array based on user input using filter in JavaScript ?
body: <p>I am trying to use a filter in javascript to search on an array.
  Following is my array:-</p>
  
  <pre><code> "customerStatusInfoList": [
              {
                  "customerId": 1110000012,
                  "caseStatus": "pending",
                  "customerName": "Robert",
                  "dateOfRequest": "2018-12-15 00:00:00.0"
              },
              {
                  "customerId": 1110000004,
                  "auditorName": "DcbAdmin",
                  "caseStatus": "pending",
                  "customerName": "Sam",
                  "dateOfRequest": "2018-12-14 12:40:04.0"
              }
          ]
  </code></pre>
  
  <p>And I am using the following function to filter the array:-</p>
  
  <pre><code>  filterTable = event =&gt; {
      console.log("event.target.value", event.target.value);
      console.log("rows", this.state.rows);
  
      if (event.target.value !== "") {
        let newRow = this.state.rows.filter(items =&gt; {
          console.log("item.name", items.customerName);
          if (items.customerName!== null)
            return items.customerName
              .toLowerCase()
              .includes(event.target.value.toLowerCase());
        });
  
        this.setState({ rows: newRow, query: event.target.value });
      } else {
        console.log("Query string is empty ", event.target.value);
        let newRow = this.state.custList;
        console.log("new row :", newRow);
        this.setState({ query: event.target.value, rows: newRow });
      }
    };
  </code></pre>
  
  <p>I am able to filter on the customerName but when I try to filter using customerId or any other parameter I get customerId.includes is not a function.
  But it works on customerName.
  How can I filter on the entire table using JavaScript filter?
  Any help or suggestion is appreciated. Thank you.</p>