
The JavaScript Language
|
9
the keyword this refers to the object for which the function
is a property.
Within the body of a function, the
arguments[] array con-
tains the complete set of arguments passed to the function.
See Function and Arguments in the reference section.
null and undefined
There are two JavaScript values that are not of any of the
types described above. The JavaScript keyword
null is a spe-
cial value that indicates “no value”. If a variable contains
null, you know that it does not contain a valid value of any
other type. The other special value in JavaScript is the unde-
fined value. This is the value of uninitialized variables and
the value returned when you query object properties that do
not exist. In JavaScript 1.5, there is a pre-defined global vari-
able named
undefined that holds this special undefined
value.
null and undefined serve similar purposes and the ==
operator considers them equal; if you need to distinguish
between them, use the
=== operator.
Expressions and Operators
JavaScript expressions are formed by combining values
(which may be literals, variables, object properties, array ele-
ments, or function invocations) using JavaScript operators.
Parentheses can be used in an expression to group subex-
pressions and alter the default order of evaluation of the
expression. Some examples:
1+2
total/n
sum(o.x, a[3])++
JavaScript defines a complete set of operators, most of which