They don’t know, they just evolved that way over time as plants that look like nettles don’t get eaten so much. The same reason giraffes that have longer necks can reach the higher leaves on the trees are less likely to starve, so they are therefore more likely to continue propagating their species.
Latest Answers