When dealing with the structure of javascript in a website. Currently i try to seperate all my javascript into files, something like app.js.
Although is it better just to place scripts on the actual page they appear, with tags? and if so what are the reasons?
The general rule of thumb is to place your script files in an external file. The Yahoo Developer site also calls for this:
To do not forget WordPress in this post, you should know that this CMS has requirements concerning the call of javascript files : always have
wp_head()
just before the closing</head>
and havewp_footer()
just before the closing</body>
This is in the case you call your external files using the
<script>
tag. But in WordPress the best way is to enqueue it using: http://codex.wordpress.org/Function_Reference/wp_enqueue_script