'Filtering an array based off of another objects values [duplicate]

I'd like to filter this programs array (I've simplified the objects):

const programs = [
      {
        format: "In-Person",
        schedule: "Full-Time",
      },
      {
        format: "Remote",
        schedule: "Full-Time",
      },
      {
        format: "In-Person",
        schedule: "Part-Time",
      },
      {
        format: "Remote",
        schedule: "Part-Time",
      }
    ]

based on a filter object:

const filters = {format: "Remote", schedule:"Full-Time"}

My attempt:

  let filteredPrograms = programs.filter((program) => {
    return Object.entries(filters).every(([key, value]) => {
      program[key] == value;
    });
  });

This should analyze each program, and allow is to pass through the filter IF: For every filter key, the program[filter key] value matches the filter value

But I'm getting an empty array for filteredPrograms



Sources

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

Source: Stack Overflow

Solution Source