Check out example codes for "unity get layer of gameobject". It will help you in understanding the concepts better.

Code Example 1

// This will retrun the layer mask of the specified gameObject
gameObject.layer

// You can as well modify this value through code
gameObject.layer = LayerMask.NameToLayer("SomeOtherLayer")

Learn ReactJs, React Native from akashmittal.com