Map

Map
πŸ‘¨β€πŸ’Ό The map method creates a new array by transforming each element.
const numbers = [1, 2, 3]
const doubled = numbers.map((n) => n * 2)
// [2, 4, 6]
The callback receives each element and returns the transformed value.
🐨 Open
index.ts
and:
  1. Use map to extract product names from an array of products
  2. Use map to create formatted price strings
  3. Use map to transform products into a different shape
πŸ’° map returns a new array of whatever your callback returns.

Please set the playground first

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