Changes

Understanding JavaScript Functions

50 bytes added, 19:02, 24 April 2007
Where to Place Function Declarations
== Where to Place Function Declarations ==
There are two recommended locations to place function declarations. These are either within the ''<head>'' section of the HTML document from which they will be called, or within a .js include file that is included in the ''<head>''. The preferred location is in the .js file since this provides the mosty flexibility in terms of making the functions available in other pages.
The Further, the objective in writing functions is to make them as general as possible in order to maximize re-use. Be sure to take a little time when designing functions to consider how you can might make this the function useful in the future, not just for the current requirement.