Map

πŸ‘¨β€πŸ’Ό Perfect! You've used map to transform arrays in different ways.
πŸ¦‰ Notice how TypeScript inferred the types:
  • names is Array<string>
  • prices is Array<string>
  • summary is Array<{ name: string; priceLabel: string }>
The parentheses around the object literal in map are important:
// βœ… Correct - returns an object
products.map((p) => ({ name: p.name }))

// ❌ Wrong - curly braces interpreted as function body
products.map((p) => {
	name: p.name
}) // Returns undefined!

Please set the playground first

Loading "Map"
Loading "Map"