Check out example codes for "ruby map". It will help you in understanding the concepts better.

Code Example 1

array = ["a", "b", "c"]
array.map { |string| string.upcase }
# ["A", "B", "C"]

Code Example 2

array = [0, 1, 2]
array.map { |number| number }

Code Example 3

hash = { bacon: "protein", apple: "fruit" }

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

Learn ReactJs, React Native from akashmittal.com