# 033: Map
# Transform each element in a collection

numbers = [1, 2, 3, 4, 5]

# Double each number
doubled = numbers.map((x) => x * 2)
show doubled  # [2, 4, 6, 8, 10]

# Square each number
squared = numbers.map((x) => x * x)
show squared  # [1, 4, 9, 16, 25]

# Transform strings
names = ["alex", "jordan", "casey"]
uppercase_names = names.map((name) => name.uppercase())
show uppercase_names  # ["ALEX", "JORDAN", "CASEY"]

# Extract property from objects
users = [
  { name: "Alex", age: 28 },
  { name: "Jordan", age: 25 },
  { name: "Casey", age: 30 }
]

names = users.map((user) => user.name)
show names  # ["Alex", "Jordan", "Casey"]
