The function of anger is to protect vulnerability and neutralize threat.
The threat humans cognitively perceive is almost always to the ego i.e., how we want to think of ourselves and have others think of us. Anger neutralizes ego-threat by devaluing, demeaning, or undermining the “power” of the person perceived to be threatening. Humans get angry when they don’t get what they want, when they’re disrespected, or when they perceive something is unjust/unfair. Anger, the emotion, is a chemical messenger. It communicates to us, to others, and motivates us to act, speak, do something. Healthy responses to anger include being assertive, feeling empowered, protecting ourselves and love ones from ACTUAL threat, setting boundaries with others, and making social change for justice (for example). It becomes unhealthy when we become passive-aggressive, violent, vengeful, spiteful, aggressive, resentful, sarcastic, “moody”, rude etc.
Receive the message and respond from a wise, calm place after the intensity of the emotion has past. Sometimes we have to act in the moment. Our ancestors may have required this for fight/flight survival. These days, we can generally PAUSE and calm the self before responding from a mindful and compassionate heart and mind. Remember: Hurt people, hurt people.