I've the below array of objects.
How do I iterate over it to change inventory and unit_price if product name is found, and create new product if the name is no found.
for example, if in my_product the name is stool as shown, this record to be added to the array, but if the name is, let's say table then the inventory and unit_price of product table are required to be adjusted.
let products = [
  {
    name: "chair",
    inventory: 5,
    unit_price: 45.99
  },
  {
    name: "table",
    inventory: 10,
    unit_price: 123.75
  },
  {
    name: "sofa",
    inventory: 2,
    unit_price: 399.50
  }
];
let my_product = {name: "stool", inventory: 1, unit_price: 300}
 
     
     
     
     
    