How to Add Javascript to alla pages/posts in Wordpress

How do I add a custom Javascript to all pages/posts in Wordpress? Is there a plugin that can do just that?