...
let stock = [
{ candy: "Twix", available: 150, weeklyAverage: 200 },
{ candy: "Kit Kat", available: 80, weeklyAverage: 100 },
{ candy: "Skittles", available: 250, weeklyAverage: 170 },
{ candy: "Reese's Pieces", available: 120, weeklyAverage: 40 }
];
// create a function named countCandyVarieties
function countCandyVarieties(stock) {
}
...
I am having trouble figuring out how to iterate through the stock array and determine the total number of candy varieties. The candies in stock include Twix, Kit Kat, Skittles, and Reese's Pieces, totaling 4 varieties. Can someone please assist me in writing the function that should return the final count?