Layer masking is a reversible way to hide part of a layer. This gives you more editing flexibility than permanently erasing or deleting part of a layer. Layer masking is useful for making image composites, cutting out objects for use in other documents, and limiting edits to part of a layer.
You can add black, white, or gray color to a layer mask. One way to do that is by painting on the layer mask. Black on a layer mask hides the layer that contains the mask, so you can see what is underneath that layer. Gray on a layer mask partially hides the layer that contains the mask. White on a layer mask shows the layer that contains the mask. ( source https://helpx.adobe.com/photoshop/how-to/layer-mask.html )