Placement of JavaScript Code

AusQB

New Member
For very small scripts with only a couple lines, there's no harm in just including it in the head element of the page, especially if it is only going to be used on that page.

However, if the script is large, it is appropriate to create a separate .js file and link it.

Either way is fine, but I prefer to always link to an external file, simply for the sake of aggregation.
 
Top