'Javascript perform every with nested includes

Thanks in advance for your help!

I have the following data:

selectedProducts = ["Saab", "Volvo", "BMW"];

Upon clicking on checkboxes. I want to show all options associated to those selected products. I am doing this:

const hasSelectedProducts = this.selectedProducts.every(product =>
  dealer.products.includes(product)
);

The problem is that I am only checking for only one product, and not multiple products. How can I check for all selected products? Thanks



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source