[Solved] Filtering data using ‘AND’ condition of inputs given


Instead of using map on filtered you might wana use every instead:

 function filterYes(data, keys){
   return data.filter(data => keys.every(key => data[key] === "yes"));
 }

I guess your data is an array (cause you call map on it) otherwise its a bit more complicated:

 function filterYes(data, key){
  return Object.assign({}, ...Object.entries(data).filter(([key, value]) =>
     keys.every(key => value[key] === "yes")
 ).map(([key, value]) => ({[key]: value}));
}

solved Filtering data using ‘AND’ condition of inputs given