Array Iteration
Iteration
π¨βπΌ We need to process our inventory data. We'll do this the manual way first
so you can see the baseline before we introduce array methods later.
π¨ Open
and:
- Use
for...ofto log each product's name and price - Build an
inStockProductsarray containing only products whereinStock === true(for the provided data, length should be3) - Count products with
price > 50intoexpensiveCount(for the provided data, the count should be3) - Export
products,inStockProducts, andexpensiveCount
Keep the provided
products fixture as-is.for...of loops work well with arrays and preserve item types.π MDN - for...of


