Getting object data with key value in JavaScript

I have an object like this:

{
  "idMeal": "52795",
  "strMeal": "Chicken Handi",
  "strDrinkAlternate": null,
  "strCategory": "Chicken",
  "strArea": "Indian"
}

I am trying to get the value of other items(i.e. strMeal and strCategory) using the value of "idMeal". How can I do that?

>Solution :

As far as i understood you want to filter an list of food objects, just put them in an array and filter like this:

[obj1, obj2, obj3].filter(o => o.idMeal="52795")

Leave a Reply