Seeking assistance on code. I have two arrays: one containing product IDs and the other with full product details. My goal is to log products based on the product ID array by searching the product details array. If a match is found, the entire product details will be printed. Below are the two arrays:
var product_id = [
{
"order_id": "281774",
"product_id": "203751",
},
{
"order_id": "281774",
"product_id": "198999",
},
{
"order_id": "281774",
"product_id": "199291",
},
{
"order_id": "281774",
"product_id": "256156",
}
];
Second Array
var product_details = [
{
"id": "219",
"product_id": "198999",
"sku": "20148089",
"prod_name": "Chocolate Mousse 1L",
"price": "39.99"
},
{
"id": "220",
"product_id": "199291",
"sku": "20008307",
"prod_name": "Medium Carrots 500g",
"price": "9.99"
},
{
"id": "221",
"product_id": "204759",
"sku": "6009207908908",
"prod_name": "Fresh Spicy Lentil & Vegetable Soup 600g",
"price": "39.59"
},
{
"id": "222",
"product_id": "199015",
"sku": "6009182131643",
"prod_name": "Bulk Gouda Cheese 900g",
"price": "77.62"
},
{
"id": "249",
"product_id": "200051",
"sku": "6009195203320",
"prod_name": "Salted Butter 500g",
"price": "76.95"
}
]