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
index.ts
and:
  1. Use for...of to log each product's name and price
  2. Build an inStockProducts array containing only products where inStock === true (for the provided data, length should be 3)
  3. Count products with price > 50 into expensiveCount (for the provided data, the count should be 3)
  4. Export products, inStockProducts, and expensiveCount
Keep the provided products fixture as-is.
for...of loops work well with arrays and preserve item types.

Please set the playground first

Loading "Array Iteration"
Loading "Array Iteration"
Login to get access to the exclusive discord channel.
Loading Discord Posts