Q:

ruby map

array = ["a", "b", "c"]
array.map { |string| string.upcase }
# ["A", "B", "C"]
1
array = [0, 1, 2]
array.map { |number| number }
0
hash = { bacon: "protein", apple: "fruit" }

hash.map { |k,v| [k, v.to_sym] }.to_h
# {:bacon=>:protein, :apple=>:fruit}
0

New to Communities?

Join the community