I have an array of objects like this:
[
{
category: 'ELECTRONICS',
sub_category: 'CONSOLE'
},
{
category: 'ELECTRONICS',
sub_category: 'CONSOLE'
},
{
category: 'ELECTRONICS',
sub_category: 'TV'
}
]
Now I want to filter when category and sub_category same.
How can I do it ?
2
Answers
A simple comparison of the two string will do the trick.