That returns an empty array. I have also tried using the array of selectedRules[0] itself but got same result. How can we do the comparison of filter on an array of objects against an array of strings to return an array of objects with each filtered rule?
const allRules = [
{
RuleName: "Two",
RuleId: 2
},
{
RuleName: "Three",
RuleId: 3
},
{
RuleName: "Four",
RuleId:4
}
];
const selectedRules = ["2", "3"]
const filteredRule = allRules.filter(x => x.RuleId === selectedRules)
console.log(filteredRule) // []