Search within TutorialsPark

Javascript Best Practices : Deployment

Learn the Best Practices to deploy the final code on the website.

Javascript Performance : Final Deployment.

The last but not the least of the best practices to be followed while Developing JavaScript Website is the final Deployment of the code.

While final Deployment of the code, following best practices should be kept in mind

Copyrights : Intellectual property claims if any should be specified within the code using comments where ever required.

Code Placement : The placement of the code for the purpose of maintainability is not always the best way for the browser. Hence a correct balance must be struck.

File Size : Writing code for the purpose of better maintainability, negatively hits the performance because of larger file size due to extra white spaces, indentation , long comment lines etc.

Javascript Deployment: Build Process

A Build Process specifies the set of logical structures that should be used for storing files on the server. They are as follows:

1. Instead of having all your JavaScript in a single file, instead its better to categorize them based on their type and then link them to the webpage, but this is only for the purpose of Maintainability.

2. For the sake of performance, its better to have most of the JavaScript in a single file, since its reduces the no of HTTP request, more the number of files , more the HTTP requests and hence more time to load the pages.

3. When the browser's JavaScript interpreter finds a <script> tag, it blocks all other downloads while the code is being downloaded and executed.

3. Another way to increase code performance, is to avoid Double Interpretation of the code, i.e when JavaScript code tries to interpret JavaScript code using eval()

4. Use some tools available on the internet for JavaScript validation, most popular being Douglas Crockford's JSLint (

5. The Wire weight is used to describe the actual number of bytes sent by a server to the client, the number of bytes is not always equal to the file size of the code, because code can be compressed at the server and then decompressed at the client side, thus reducing the wire weight