Open Directory Site JavaScript Tutorials

ASP | XML | VBScript | JavaScript | ADO | CSS | XMLDOM | PHP | Operating Systems

Home >> JavaScript >> JavaScript Guidelines

 JavaScript Guidelines

 

JavaScript is Case Sensitive

A function named "myfunction" is not the same as "myFunction". Therefore watch your capitalization when you create or call variables, objects and functions.

Symbols

Open symbols, like ( { [ " ', must have a matching closing symbols, like ' " ] } ).

White Space

JavaScript ignores extra spaces. You can add white space to your script to make it more readable. These two lines means exactly the same:

name="Hege"

name = "Hege"

Break up a Code line

You can break up a code line with the backslash. The example below will be displayed properly:

document.write \

("Hello World!")

You can insert special characters (like " ' ; &) with the backslash:

document.write ("Me \& you sings \"Happy Birthday\".")

The example above will produce this output:

Me & you sings "Happy Birthday".

Comments

You can turn a line into a comment, like this

// This is a comment

You can also create a comment block, like this:

/* This is a comment block. It contains several lines*/

Cheap Web Hosting Articles - Web Site Design & Web Hosting Tutorials - Domain Hosting