[<< wikibooks] JavaScript/Lexical structure
== Case Sensitivity ==
JavaScript is case-sensitive. This means that Hello() is not the same as HELLO(), hello(), or even hEllo().

== Whitespace ==
Whitespace can be: extra indents, line breaks, and spaces. JavaScript ignores it, but it makes the code easier for people to read.The following is JavaScript with very little whitespace.

The following is the same JavaScript with a typical amount of whitespace.

The following is the same JavaScript with a lot of whitespace.

== Comments ==
Comments allow you to leave notes in your code to help other people understand it. They also allow you to comment out code that you want to hide from the parser, but you don't want to delete.

Single-line commentsA double slash, //, turns all of the following text on the same line into a comment that will not be processed by the JavaScript interpreter.

Multi-line commentsMulti-line comments are begun with slash asterisk, /*, and end with the reverse asterisk slash, */.
Here is an example of how to use the different types of commenting techniques.

== Semicolons ==
In many computer languages, semicolons are required at the end of each code statement. In JavaScript the use of semicolons is optional, as a new line indicates the end of the statement. This is called automatic semicolon insertion, and the rules for it are quite complex. Leaving out semicolons and allowing the parser to automatically insert them can create complex problems.

The above code is not interpreted as two statements. Because of the parentheses on the second line, JavaScript interprets the above as if it were

when instead, you may have meant it to be interpreted as

Even though semicolons are optional, it's preferable to end statements with a semicolon to prevent any misunderstandings from taking place.

== Literals ==
A literal is a hard coded value. Literals provide a means of expressing specific values in your script. For example, to the right of the equals sign:

There are several types of literals available. The most common are the string literals, but there are also integer and floating-point literals, array and boolean literals, and object literals.
Example of an object literal:

Details of these different types are covered in Variables and Types.

== Identifiers ==
An identifier is a name for a piece of data such as a variable, array, or function. There are rules:

Letters, dollar signs, underscores, and numbers are allowed in identifiers.
The first character cannot be a number.Examples of valid identifiers:

hello901A2B3C is an invalid identifier, as it starts with a number.

=== Naming variables ===
When naming variables there are some rules that must be obeyed:

Upper case and lower case letters of the alphabet, underscores, and dollar signs can be used
Numbers are allowed after the first character
No other characters are allowed
Variable names are case sensitive: different case implies a different name
A variable may not be a reserved word

== References ==