0

I'm filtering a data its categories. And I'm using a filter and match. When I console log the data I want to match it the same. But the match function doesn't match it.

  const id = this.filterByCategory;
    if (id === null) {
      await this.getProdName();
      return;
    }
    let filteredItems = await this.getProdName();

    filteredItems = filteredItems.filter(product => {
      console.log("product.category_id", product.category_id, "id", id);
      product.category_id.match(id);
    });
    console.log(filteredItems);
    this.selectProduct = filteredItems;

This is the result of my console log

product.category_id 609521209d10ac4774748c74 ,id 609521209d10ac4774748c74

this is the result of the filteredItems

Thanks in Advance for the help.

David Uy
  • 11
  • 2

0 Answers0