Does fainting have any evolutionary advantage?

Or is it a biological flaw? What benefit does it provide if any if it isn't simply a flaw and has some actual reason behind it?
Update: Don't know if I should put this here or in medicine
7 answers 7