Suppose I write a site with four pages. These pages have the same functionality (the same JavaScript), but there are differences.
How to organize the code? Is it possible to stuff everything into one file? And how to hang handlers, such as buttons, if they are on one page and not on the other?