The skin has several important roles. It acts as a barrier to protect the body from injury, the intrusion of foreign particles, and the loss of water and nutrients. It is also important for thermoregulation. Blood vessels near the surface of the skin can dilate, allowing for higher blood flow and the release of heat. They can also constrict to reduce the amount of blood that travels near the surface of the skin, which helps conserve heat. The skin also produces vitamin D when exposed to sunlight.
Because the skin covers the whole body, it plays a vital role in allowing organisms to interact with the environment. It is home to nerve endings that sense temperature, pressure, and pain, and it also houses glands that help maintain homeostasis. Eccrine glands, which are located primarily in the palms of the hands and soles of the feet (and to a lesser degree in other areas of the body), release the water and salt (NaCl) mixture called sweat. These glands help the body maintain the appropriate salt/water balance. Sweat can also contain small amounts of other substances the body needs to expel, including alcohol, lactic acid, and urea.
Apocrine glands, which are located primarily in the armpit and groin, release an oily substance that contains pheromones. They are also sensitive to adrenaline, and are responsible for most of the sweating that occurs due to stress, fear, anxiety, or pain. Apocrine glands are largely inactive until puberty.