Check out example codes for "ruby find index of element in array". It will help you in understanding the concepts better.

Code Example 1

a = [ "a", "b", "c" ]
a.index("b")              #=> 1
a.index("z")              #=> nil

Learn ReactJs, React Native from akashmittal.com