The answer, like most things, is because they are useful – or at least they were useful to our ancestors whom we evolved from. Try peeling an orange with no fingernails. Or (if you were a monkey, which whom we are closely related and share fingernails), grooming yourself, or scratching, or stripping bark from a tree. They were probably used for grooming or getting food or even using basic tools as we evolved, and we still have them today.
Comments