How have sharks survived for 400 million years?

Sharks roamed the seas over 400 million years ago, before the dinosaurs. They’ve survived 5 mass extinctions and evolved into a perfect predator. So what has made them so successful?