HTML and CSS Reference
Whitespace is preserved when it is embedded within a string or regular expression.
For example, the whitespace in the string, “Hello there” will be preserved because
it is enclosed within double quotes. Of course, you can't break up a word such as switch ,
if , else , window , document , and so on, because it would no longer be the same word.
break lines, and organize your program so that it is easier to read and debug.
not be used by programmers as identifiers for variables, functions and labels, and the like.
Words such as if , for , while , return , null , and typeof are examples of reserved words.
Table 2.1 gives a list of reserved words.
Table 2.1 Reserved Keywords
bre a k
Just like sentences (which represent complete thoughts) in the English language, Java-
Script statements are made up of expressions. The statements are executed top down,
one statement at a time. If there are multiple statements on a line, the statements must
be separated by semicolons. Although not a rule, it is good practice to terminate all state-
free form, as long as statements are terminated with a semicolon, the lines can be bro-
ken, contain whitespace, and so on. A statement results in some action unless the state-
ment is a null statement, in which case it does nothing.
The following two lines are both technically correct:
var name = "Ellie"
<- no semicolon, valid
var name = "Ellie" ;