I am trying to merge a Javascript array and object to get one result.
Here is my code:
let allPlans = plans.map((p) => ({
...p,
subscription: subscription?.filter(
(s) => p.id == s.price.id
),
}));
The error I am getting is TypeError: subscription.filter is not a function
Plans is an array and subscription is an object.