You were tasked with making a list of every makeup item your local pharmacy had in stock. You created a very long array of each item, with each element having both a name and brand property. Now you're looking to simplify the list by combining duplicate items, and adding a count property to everything.
simplifyList([
{ brand: "NARS", name: "Cosmetics Voyageur Pallete" },
{ brand: "NARS", name: "Cosmetics Voyageur Pallete" },
{ brand: "Urban Decay", name: "Naked Honey Pallete" },
{ brand: "Stila", name: "Stay All Day Liquid Lipstick" },
{ brand: "Stila", name: "Stay All Day Liquid Lipstick" },
{ brand: "Stila", name: "Stay All Day Liquid Lipstick" }
]) ➞ [
{ brand: "NARS", name: "Cosmetics Voyageur Pallete", count: 2 },
{ brand: "Urban Decay", name: "Naked Honey Pallete", count: 1 },
{ brand: "Stila", name: "Stay All Day Liquid Lipstick", count: 3 }
]
brand and name property.