Looking for the best way to filter an array of objects by a specific property called "Country" based on user selection. The goal is to return only the objects that match the selected countries. What is the most efficient approach to achieve this?
var countries = [{GINI: 56.2, Country: "Central African Republic", Values: Array, Date: "2008"},
{GINI: 51.3, Country: "Brazil", Values: Array, Date: "2015"},{GINI: 51.1, Country: "Columbia", Values: Array, Date: "2015"}]
var selectedCountries = ["Central African Republic", "Columbia"];
var filteredCountries = countries.filter(country =>{
??
});
The expected output should be a filtered version of the original countries array containing only the matches.