I'm making a function that will count through data food amount.
const countFood = (foodType) => {
  let foodNeeded = 0;
  if (animal.food.type === foodType) {
    foodNeeded += +animal.food.amount;
  };
  const food = foodType;
  if (foodNeeded > (pavilion.food[food] - 1)) return true;
  countFood(foodType);
}
countFood('meat');
It's a piece of code in for loop.
I need use this argument to request it like pavilion.food.meat
 
     
    