Best JavaScript Coding standards

Posted on March 14th, 2011

1. Using the script tag ()
2. Define the type and language.
3. Keep code in an external file
4. Avoid using script codes inside html comments
5. Declare the javascript variables using ‘var’
6. Using inline javascript is a bad practice, we can use unobtrusive javascript.
7. Include the scripts in the bottom of html files.
8. Using JSlinks is a good practice
9. Instead of using document.write(“hello world”);, we can use ‘document.getElementById(‘hello’).innerHTML(‘hello world’);’