struct Product {
let name: String
let weight: Double
}
let productsList = [Product(name: "AAA", weight: 1),
Product(name: "BBB", weight: 2),
Product(name: "CCC", weight: 3),
Product(name: "DD", weight: 4),
Product(name: "RR", weight: 5),
Product(name: "EEE", weight: 6),
Product(name: "FGT", weight: 7),
Product(name: "DSF", weight: 8),
Product(name: "VCVX", weight: 9),
Product(name: "GFDHT", weight: 10)]
print(productsList.map { $0.name })
I am getting all the product names from the above line but I want to get only names from odd indexes using map. Is it possible?