<html>
<link rel="stylesheet" href="josh.css">
<body bgcolor="#FFFFFF">
<div id="=">
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
<tr>
<td valign="top" class="name">=</td>
<td valign="top" nowrap class="compatibility">NN <span class="emphasis">2</span> IE <span class="emphasis">3</span> ECMA <span class="emphasis">1</span>&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" nowrap class="usage"><p class="literal">
</p></td>
<td valign="top" nowrap class="requirements">&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="description"><p>
The assignment operator assigns the evaluated value of the right-hand
operand to the variable on the left. After the operation, the
variable contains data of the same data type as the original value.
Assignment operations can also be chained, with the evaluation of the
entire statement starting from the right and working left. Therefore,
after the expression:
</p>
<span class="PROGRAMLISTING"><pre>a = b = c = 25;</pre></span>
</td>
</tr>
<tr>
<td colspan="2"><p>
all three variables equal 25.
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="example"><span class="title">Example</span></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td><span class="programlisting">
<pre>var myName = "Theodore Roosevelt";
var now = new Date( );</pre>
</span></td>
</tr>
</table>
</div>
<div id="&">
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
<tr>
<td valign="top" class="name">&amp;</td>
<td valign="top" nowrap class="compatibility">NN <span class="emphasis">2</span> IE <span class="emphasis">3</span> ECMA <span class="emphasis">1</span>&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" nowrap class="usage"><p class="literal">
</p></td>
<td valign="top" nowrap class="requirements">&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="description"><p>
The bitwise AND operator performs binary math on two operands (their
binary values). Each column of bits is subjected to the Boolean AND
operation. If the value of a column in both operands is 1, the result
for that column position is 1. All other combinations yield a zero.
The resulting value of the operator is the decimal equivalent of the
binary result. For example, the binary values of 3 and 6 are 0011 and
0110, respectively. After an AND operation on these two values, the
binary result is 0010; the decimal equivalent is 2.
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="example"><span class="title">Example</span></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td><span class="programlisting">
<pre>var n = 3 &amp; 6;</pre>
</span></td>
</tr>
</table>
</div>
<div id="<<">
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
<tr>
<td valign="top" class="name">&lt;&lt;</td>
<td valign="top" nowrap class="compatibility">NN <span class="emphasis">2</span> IE <span class="emphasis">3</span> ECMA <span class="emphasis">1</span>&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" nowrap class="usage"><p class="literal">
</p></td>
<td valign="top" nowrap class="requirements">&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="description"><p>
The bitwise left-shift operator shifts the bits of the first operand
by the number of columns specified by the second operand. For
example, if the binary value of 3 (0011) has its bits shifted to the
left by 2, the binary result is 1100; the decimal equivalent is 12.
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="example"><span class="title">Example</span></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td><span class="programlisting">
<pre>var shifted = 3 &lt;&lt; 2;</pre>
</span></td>
</tr>
</table>
</div>
<div id="~">
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
<tr>
<td valign="top" class="name">~</td>
<td valign="top" nowrap class="compatibility">NN <span class="emphasis">2</span> IE <span class="emphasis">3</span> ECMA <span class="emphasis">1</span>&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" nowrap class="usage"><p class="literal">
</p></td>
<td valign="top" nowrap class="requirements">&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="description"><p>
This is the bitwise NOT operator. This unary operator inverts the
value of the binary digit in each column of a number. For example,
the binary 6 is 0110 (with many more zeros off to the left). After
the negation operation on each column's value, the
binary result is 1001, plus all zeros to the left inverted to 1s. The
decimal equivalent is a negative value (-5).
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="example"><span class="title">Example</span></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td><span class="programlisting">
<pre>var n = ~6;</pre>
</span></td>
</tr>
</table>
</div>
<div id="|">
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
<tr>
<td valign="top" class="name">|</td>
<td valign="top" nowrap class="compatibility">NN <span class="emphasis">2</span> IE <span class="emphasis">3</span> ECMA <span class="emphasis">1</span>&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" nowrap class="usage"><p class="literal">
</p></td>
<td valign="top" nowrap class="requirements">&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="description"><p>
The bitwise OR operator performs binary math on two operands (their
binary values). Each column of bits is subjected to the Boolean OR
operation. If the value of a column in both operands is 0, the result
for that column position is 0. All other combinations yield a 1. The
resulting value of the operator is the decimal equivalent of the
binary result. For example, the binary values of 3 and 6 are 0011 and
0110, respectively. After an OR operation on these two values, the
binary result is 0111; the decimal equivalent is 7.
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="example"><span class="title">Example</span></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td><span class="programlisting">
<pre>var n = 3 | 6;</pre>
</span></td>
</tr>
</table>
</div>
<div id=">>">
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
<tr>
<td valign="top" class="name">&gt;&gt;</td>
<td valign="top" nowrap class="compatibility">NN <span class="emphasis">2</span> IE <span class="emphasis">3</span> ECMA <span class="emphasis">1</span>&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" nowrap class="usage"><p class="literal">
</p></td>
<td valign="top" nowrap class="requirements">&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="description"><p>
The bitwise right-shift operator shifts the bits of the first operand
by the number of columns specified by the second operand. For
example, if the binary value of 6 (0110) has its bits shifted to the
right by 2, the binary result is 0001; the decimal equivalent is 1.
Any digits that fall off the right end of the number are discarded.
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="example"><span class="title">Example</span></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td><span class="programlisting">
<pre>var shifted = 6 &gt;&gt; 2;</pre>
</span></td>
</tr>
</table>
</div>
<div id="^">
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
<tr>
<td valign="top" class="name">^</td>
<td valign="top" nowrap class="compatibility">NN <span class="emphasis">2</span> IE <span class="emphasis">3</span> ECMA <span class="emphasis">1</span>&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" nowrap class="usage"><p class="literal">
</p></td>
<td valign="top" nowrap class="requirements">&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="description"><p>
The bitwise exclusive OR (XOR) operator performs binary math on two
operands (their binary values). Each column of bits is subjected to
the Boolean XOR operation. If the value of a column in either operand
(but not both operands) is 1, the result for that column position is
1. All other combinations yield a 0. The resulting value of the
operator is the decimal equivalent of the binary result. For example,
the binary values of 3 and 6 are 0011 and 0110, respectively. After
an XOR operation on these two values, the binary result is 0101; the
decimal equivalent is 5.
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="example"><span class="title">Example</span></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td><span class="programlisting">
<pre>var n = 3 ^ 6;</pre>
</span></td>
</tr>
</table>
</div>
<div id=">>>">
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
<tr>
<td valign="top" class="name">&gt;&gt;&gt;</td>
<td valign="top" nowrap class="compatibility">NN <span class="emphasis">2</span> IE <span class="emphasis">3</span> ECMA <span class="emphasis">1</span>&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" nowrap class="usage"><p class="literal">
</p></td>
<td valign="top" nowrap class="requirements">&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="description"><p>
This is the bitwise zero-fill right-shift operator. This operator
shifts the bits of the first operand (to the right) by the number of
columns specified by the second operand. With the bitwise right-shift
operator (<span class="literal">&gt;&gt;</span>), new digits that fill in from
the left end are 1s; with the zero-fill right-shift operator
(<span class="literal">&gt;&gt;&gt;</span>), the new digits at the left are
zeros. Any digits that fall off the right end of the number are
discarded. Microsoft also refers to this operator as the unsigned
right-shift operator.
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="example"><span class="title">Example</span></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td><span class="programlisting">
<pre>var shifted = 6 &gt;&gt;&gt; 2;</pre>
</span></td>
</tr>
</table>
</div>
<div id=",">
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
<tr>
<td valign="top" class="name">,</td>
<td valign="top" nowrap class="compatibility">NN <span class="emphasis">2</span> IE <span class="emphasis">3</span> ECMA <span class="emphasis">1</span>&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" nowrap class="usage"><p class="literal">
</p></td>
<td valign="top" nowrap class="requirements">&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="description"><p>
The comma operator (with or without optional white space following
it) can delimit expressions in the same line of script. It can be
used in a number of ways. For example, to declare multiple variables,
the syntax would be:
</p>
<programlisting>var varName1, varName2, ... varNameN;</programlisting>
</td>
</tr>
<tr>
<td colspan="2"><p>
Multiple script statements may also be joined together on the same
line. Therefore, the following script line:
</p>
<programlisting>alert(&quot;Howdy&quot;), alert(&quot;Doody&quot;);</programlisting>
</td>
</tr>
<tr>
<td colspan="2"><p>
presents two alert dialog boxes in sequence (the second one appears
after the first is dismissed by the user). Another application is in <span class="literal">for</span> loops when you wish to involve two (or more)
variables in the loop:
</p>
<span class="PROGRAMLISTING"><pre>for (var i = 0, var j = 2; i&lt; 20; i++, j++) {
    ...
} </pre></span>
</td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="example"><span class="title">Example</span></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td><span class="programlisting">
<pre>var isCSS, isIEMac;</pre>
</span></td>
</tr>
</table>
</div>
<div id="/*...*/">
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
<tr>
<td valign="top" class="name">//, /*...*/</td>
<td valign="top" nowrap class="compatibility">NN <span class="emphasis">2</span> IE <span class="emphasis">3</span> ECMA <span class="emphasis">1</span>&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" nowrap class="usage"><p class="literal">
</p></td>
<td valign="top" nowrap class="requirements">&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="description"><p>
These are comment statements that let you enter nonexecuting text in
a script. Any text following the <span class="literal">//</span> symbol
anywhere in a statement line is ignored by the language interpreter.
The next line of script, unless it begins with another <span class="literal">//</span> symbol, is interpreted by the browser.
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2"><p>
For multiline comment blocks, you can begin a block with the <span class="literal">/*</span> symbol. Comment blocks may run any number of
lines. The block is closed with the <span class="literal">*/</span> symbol,
after which the interpreter engages subsequent statements.
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="example"><span class="title">Example</span></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td><span class="programlisting">
<pre>// convert temp from C to F

/*
many lines
of
comments
*/</pre>
</span></td>
</tr>
</table>
</div>
<div id="//">
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
<tr>
<td valign="top" class="name">//, /*...*/</td>
<td valign="top" nowrap class="compatibility">NN <span class="emphasis">2</span> IE <span class="emphasis">3</span> ECMA <span class="emphasis">1</span>&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" nowrap class="usage"><p class="literal">
</p></td>
<td valign="top" nowrap class="requirements">&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="description"><p>
These are comment statements that let you enter nonexecuting text in
a script. Any text following the <span class="literal">//</span> symbol
anywhere in a statement line is ignored by the language interpreter.
The next line of script, unless it begins with another <span class="literal">//</span> symbol, is interpreted by the browser.
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2"><p>
For multiline comment blocks, you can begin a block with the <span class="literal">/*</span> symbol. Comment blocks may run any number of
lines. The block is closed with the <span class="literal">*/</span> symbol,
after which the interpreter engages subsequent statements.
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="example"><span class="title">Example</span></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td><span class="programlisting">
<pre>// convert temp from C to F

/*
many lines
of
comments
*/</pre>
</span></td>
</tr>
</table>
</div>
<div id="@cc_on">
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
<tr>
<td valign="top" class="name">@cc_on, @if, @end, @set</td>
<td valign="top" nowrap class="compatibility">NN <span class="emphasis">n/a</span> IE <span class="emphasis">4(Win)</span> ECMA <span class="emphasis">n/a</span>&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" nowrap class="usage"><p class="literal">
</p></td>
<td valign="top" nowrap class="requirements">&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="description"><p>
IE for Windows includes a scripting feature called <span class="emphasis">conditional compilation</span>. It is a mode that, once
turned on via the <span class="literal">@cc_on</span> statement, allows JScript
statements to run under conditions that are testable within this
conditional environment. If you surround conditional compilation
statements by JavaScript comments, the conditional statements run
only in IE 4 or later for Windows, while not conflicting with other
browsers.
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2"><p>
The "conditional" part comes from
numerous global properties (all preceded with the <span class="literal">@</span> symbol) that reveal environmental properties,
such as script engine version, operating system, and CPU type. All of
this information is available from the <span class="literal">navigator</span> object's properties on a wide range of browsers, so
this is not unique information available only to this conditional
environment.
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2"><p>
To engage conditional compilation, include the following statement in
your script:
</p>
<span class="PROGRAMLISTING"><pre>/*@cc_on @*/</pre></span>
</td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2"><p>
This is a one-way toggle: once the mode is turned on, it
can't be turned off in the current page.
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2"><p>
The following fragment shows how the <span class="literal">@if</span> and
related statements display some environmental information in the
window's status bar if the browser is running
JScript Version 5.6 or later (IE 6 or later):
</p>
<span class="PROGRAMLISTING"><pre>/*@cc_on @*/
/*@if (@_jscript_version&gt;= 5.6 &amp;&amp; @_x86)
    status = &quot;Now running JScript version &quot; + @_jscript_version + 
    &quot; with Intel inside.&quot;;
   @else @*/
    status = &quot;Have a nice day.&quot;;
/*@end @*/ </pre></span>
</td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2"><p>
The <span class="literal">@set</span> statement lets you assign a numeric or
Boolean value (no strings) to a variable (a variable with an <span class="literal">@</span> prefix) within a conditional compilation
section:
</p>
<span class="PROGRAMLISTING"><pre>@set @isOK = @_win32</pre></span>
</td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2"><p>
Once initialized, that variable (including its otherwise unacceptable
identifier) can be used in script statements throughout the page.
Note that the Visual Basic-inspired syntax of <span class="literal">@</span> statements in conditional compilation statements does not permit
semicolons at the end of statements.
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2"><p>
On the one hand, conditional compilation could be useful for IE-only
deployment to screening older IE versions from new language features
that would generate compilation errors (such as <span class="literal">try-catch</span> constructions) because such statements
compile only under very controllable version situations. In a
multibrand browser development shop, however, at most you might find
application for IE-only debugging purposes, but probably not for
actual application deployment.
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="example"><span class="title">Example</span></td>
</tr>
<tr>
<td colspan="2"><p>
See the discussion above.
</p></td>
</tr>
</table>
</div>
<div id="@if">
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
<tr>
<td valign="top" class="name">@cc_on, @if, @end, @set</td>
<td valign="top" nowrap class="compatibility">NN <span class="emphasis">n/a</span> IE <span class="emphasis">4(Win)</span> ECMA <span class="emphasis">n/a</span>&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" nowrap class="usage"><p class="literal">
</p></td>
<td valign="top" nowrap class="requirements">&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="description"><p>
IE for Windows includes a scripting feature called <span class="emphasis">conditional compilation</span>. It is a mode that, once
turned on via the <span class="literal">@cc_on</span> statement, allows JScript
statements to run under conditions that are testable within this
conditional environment. If you surround conditional compilation
statements by JavaScript comments, the conditional statements run
only in IE 4 or later for Windows, while not conflicting with other
browsers.
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2"><p>
The "conditional" part comes from
numerous global properties (all preceded with the <span class="literal">@</span> symbol) that reveal environmental properties,
such as script engine version, operating system, and CPU type. All of
this information is available from the <span class="literal">navigator</span> object's properties on a wide range of browsers, so
this is not unique information available only to this conditional
environment.
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2"><p>
To engage conditional compilation, include the following statement in
your script:
</p>
<span class="PROGRAMLISTING"><pre>/*@cc_on @*/</pre></span>
</td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2"><p>
This is a one-way toggle: once the mode is turned on, it
can't be turned off in the current page.
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2"><p>
The following fragment shows how the <span class="literal">@if</span> and
related statements display some environmental information in the
window's status bar if the browser is running
JScript Version 5.6 or later (IE 6 or later):
</p>
<span class="PROGRAMLISTING"><pre>/*@cc_on @*/
/*@if (@_jscript_version&gt;= 5.6 &amp;&amp; @_x86)
    status = &quot;Now running JScript version &quot; + @_jscript_version + 
    &quot; with Intel inside.&quot;;
   @else @*/
    status = &quot;Have a nice day.&quot;;
/*@end @*/ </pre></span>
</td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2"><p>
The <span class="literal">@set</span> statement lets you assign a numeric or
Boolean value (no strings) to a variable (a variable with an <span class="literal">@</span> prefix) within a conditional compilation
section:
</p>
<span class="PROGRAMLISTING"><pre>@set @isOK = @_win32</pre></span>
</td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2"><p>
Once initialized, that variable (including its otherwise unacceptable
identifier) can be used in script statements throughout the page.
Note that the Visual Basic-inspired syntax of <span class="literal">@</span> statements in conditional compilation statements does not permit
semicolons at the end of statements.
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2"><p>
On the one hand, conditional compilation could be useful for IE-only
deployment to screening older IE versions from new language features
that would generate compilation errors (such as <span class="literal">try-catch</span> constructions) because such statements
compile only under very controllable version situations. In a
multibrand browser development shop, however, at most you might find
application for IE-only debugging purposes, but probably not for
actual application deployment.
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="example"><span class="title">Example</span></td>
</tr>
<tr>
<td colspan="2"><p>
See the discussion above.
</p></td>
</tr>
</table>
</div>
<div id="@end">
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
<tr>
<td valign="top" class="name">@cc_on, @if, @end, @set</td>
<td valign="top" nowrap class="compatibility">NN <span class="emphasis">n/a</span> IE <span class="emphasis">4(Win)</span> ECMA <span class="emphasis">n/a</span>&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" nowrap class="usage"><p class="literal">
</p></td>
<td valign="top" nowrap class="requirements">&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="description"><p>
IE for Windows includes a scripting feature called <span class="emphasis">conditional compilation</span>. It is a mode that, once
turned on via the <span class="literal">@cc_on</span> statement, allows JScript
statements to run under conditions that are testable within this
conditional environment. If you surround conditional compilation
statements by JavaScript comments, the conditional statements run
only in IE 4 or later for Windows, while not conflicting with other
browsers.
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2"><p>
The "conditional" part comes from
numerous global properties (all preceded with the <span class="literal">@</span> symbol) that reveal environmental properties,
such as script engine version, operating system, and CPU type. All of
this information is available from the <span class="literal">navigator</span> object's properties on a wide range of browsers, so
this is not unique information available only to this conditional
environment.
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2"><p>
To engage conditional compilation, include the following statement in
your script:
</p>
<span class="PROGRAMLISTING"><pre>/*@cc_on @*/</pre></span>
</td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2"><p>
This is a one-way toggle: once the mode is turned on, it
can't be turned off in the current page.
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2"><p>
The following fragment shows how the <span class="literal">@if</span> and
related statements display some environmental information in the
window's status bar if the browser is running
JScript Version 5.6 or later (IE 6 or later):
</p>
<span class="PROGRAMLISTING"><pre>/*@cc_on @*/
/*@if (@_jscript_version&gt;= 5.6 &amp;&amp; @_x86)
    status = &quot;Now running JScript version &quot; + @_jscript_version + 
    &quot; with Intel inside.&quot;;
   @else @*/
    status = &quot;Have a nice day.&quot;;
/*@end @*/ </pre></span>
</td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2"><p>
The <span class="literal">@set</span> statement lets you assign a numeric or
Boolean value (no strings) to a variable (a variable with an <span class="literal">@</span> prefix) within a conditional compilation
section:
</p>
<span class="PROGRAMLISTING"><pre>@set @isOK = @_win32</pre></span>
</td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2"><p>
Once initialized, that variable (including its otherwise unacceptable
identifier) can be used in script statements throughout the page.
Note that the Visual Basic-inspired syntax of <span class="literal">@</span> statements in conditional compilation statements does not permit
semicolons at the end of statements.
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2"><p>
On the one hand, conditional compilation could be useful for IE-only
deployment to screening older IE versions from new language features
that would generate compilation errors (such as <span class="literal">try-catch</span> constructions) because such statements
compile only under very controllable version situations. In a
multibrand browser development shop, however, at most you might find
application for IE-only debugging purposes, but probably not for
actual application deployment.
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="example"><span class="title">Example</span></td>
</tr>
<tr>
<td colspan="2"><p>
See the discussion above.
</p></td>
</tr>
</table>
</div>
<div id="@set">
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
<tr>
<td valign="top" class="name">@cc_on, @if, @end, @set</td>
<td valign="top" nowrap class="compatibility">NN <span class="emphasis">n/a</span> IE <span class="emphasis">4(Win)</span> ECMA <span class="emphasis">n/a</span>&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" nowrap class="usage"><p class="literal">
</p></td>
<td valign="top" nowrap class="requirements">&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="description"><p>
IE for Windows includes a scripting feature called <span class="emphasis">conditional compilation</span>. It is a mode that, once
turned on via the <span class="literal">@cc_on</span> statement, allows JScript
statements to run under conditions that are testable within this
conditional environment. If you surround conditional compilation
statements by JavaScript comments, the conditional statements run
only in IE 4 or later for Windows, while not conflicting with other
browsers.
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2"><p>
The "conditional" part comes from
numerous global properties (all preceded with the <span class="literal">@</span> symbol) that reveal environmental properties,
such as script engine version, operating system, and CPU type. All of
this information is available from the <span class="literal">navigator</span> object's properties on a wide range of browsers, so
this is not unique information available only to this conditional
environment.
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2"><p>
To engage conditional compilation, include the following statement in
your script:
</p>
<span class="PROGRAMLISTING"><pre>/*@cc_on @*/</pre></span>
</td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2"><p>
This is a one-way toggle: once the mode is turned on, it
can't be turned off in the current page.
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2"><p>
The following fragment shows how the <span class="literal">@if</span> and
related statements display some environmental information in the
window's status bar if the browser is running
JScript Version 5.6 or later (IE 6 or later):
</p>
<span class="PROGRAMLISTING"><pre>/*@cc_on @*/
/*@if (@_jscript_version&gt;= 5.6 &amp;&amp; @_x86)
    status = &quot;Now running JScript version &quot; + @_jscript_version + 
    &quot; with Intel inside.&quot;;
   @else @*/
    status = &quot;Have a nice day.&quot;;
/*@end @*/ </pre></span>
</td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2"><p>
The <span class="literal">@set</span> statement lets you assign a numeric or
Boolean value (no strings) to a variable (a variable with an <span class="literal">@</span> prefix) within a conditional compilation
section:
</p>
<span class="PROGRAMLISTING"><pre>@set @isOK = @_win32</pre></span>
</td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2"><p>
Once initialized, that variable (including its otherwise unacceptable
identifier) can be used in script statements throughout the page.
Note that the Visual Basic-inspired syntax of <span class="literal">@</span> statements in conditional compilation statements does not permit
semicolons at the end of statements.
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2"><p>
On the one hand, conditional compilation could be useful for IE-only
deployment to screening older IE versions from new language features
that would generate compilation errors (such as <span class="literal">try-catch</span> constructions) because such statements
compile only under very controllable version situations. In a
multibrand browser development shop, however, at most you might find
application for IE-only debugging purposes, but probably not for
actual application deployment.
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="example"><span class="title">Example</span></td>
</tr>
<tr>
<td colspan="2"><p>
See the discussion above.
</p></td>
</tr>
</table>
</div>
<div id="?:">
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
<tr>
<td valign="top" class="name">?:</td>
<td valign="top" nowrap class="compatibility">NN <span class="emphasis">2</span> IE <span class="emphasis">3</span> ECMA <span class="emphasis">1</span>&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" nowrap class="usage"><p class="literal">
</p></td>
<td valign="top" nowrap class="requirements">&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="description"><p>
The conditional operator provides a shortcut syntax to an <span class="literal">if/else</span> control structure. There are three
components to the deployment of this operator: a condition and two
statements. If the condition evaluates to <span class="literal">true</span>,
the first of the statements is executed; if the condition evaluates
to <span class="literal">false</span>, the second statement is evaluated. The
syntax is as follows:
</p>
<span class="PROGRAMLISTING">
<pre><var class="replaceable">condition </var>?<var class="replaceable"> statement1 </var>:<var class="replaceable"> statement2</var></pre>
</span> </td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2"><p>
You can nest these operators as a way of adding more decision paths
within a single statement. In the following syntax, if <var class="replaceable">conditionA</var> evaluates to <span class="literal">false</span>, <var class="replaceable">conditionB</var> is
evaluated, and the entire expression returns the value of <var class="replaceable">statement2</var> or <var class="replaceable">statement3</var> depending on the results of <var class="replaceable">conditionB</var>.
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2"><p>
This operator is a shortcut in appearance only. It invokes the same
internal processing as an <span class="literal">if...else</span> construction.
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="example"><span class="title">Example</span></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td><span class="programlisting">
<pre>var newColor = (temp &gt; 100) ? "red" : "blue";</pre>
</span></td>
</tr>
</table>
</div>
<div id="continue">
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
<tr>
<td valign="top" class="name">continue</td>
<td valign="top" nowrap class="compatibility">NN <span class="emphasis">2</span> IE <span class="emphasis">3</span> ECMA <span class="emphasis">1</span>&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" nowrap class="usage"><p class="literal">
</p></td>
<td valign="top" nowrap class="requirements">&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="description"><p>
Stops execution of the current iteration through the loop and returns
to the top of the loop for the next pass (executing the update
expression if one is specified in a <span class="literal">for</span> loop). If
you are using nested loop constructions, assign labels to each nested
layer, and use the desired label as a parameter with the <span class="literal">continue</span> statement. See the <span class="literal">label</span> statement (available only starting with
Navigator 4 and Internet Explorer 4).
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="example"><span class="title">Example</span></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td><span class="programlisting">
<pre>outerLoop:
for (var i = 0; i &lt;= maxValue1; i++) {
    for (var j = 0; j &lt;= maxValue2; j++) {
        if (j*i == magic2) {
            continue outerLoop;
        }
    }
}</pre>
</span></td>
</tr>
</table>
</div>
<div id="/char">
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
<tr>
<td valign="top" class="name">/char</td>
<td valign="top" nowrap class="compatibility">NN <span class="emphasis">2</span> IE <span class="emphasis">3</span> ECMA <span class="emphasis">1</span>&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" nowrap class="usage"><p class="literal">
</p></td>
<td valign="top" nowrap class="requirements">&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="description"><p>
JavaScript provides a mechanism for including common whitespace
characters (sometimes called control codes) inside strings, as well
as symbols that otherwise conflict with string representation. The
key is the backslash character (<span class="literal">\</span>), followed
immediately by a single character with a special meaning. The
following table shows the recognized escaped characters and their
meanings.
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2"><p>
These characters come in handy for alert, confirm, and prompt dialog
box text. For example, if you want to display multiple paragraphs
with a blank line between them in an alert box, you would insert line
feed characters:
</p>
<span class="PROGRAMLISTING"><pre>alert(&quot;First paragraph.\n\nSecond paragraph.&quot;)</pre></span>
</td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2"><p>
Note that these characters apply to strings, and do not influence
HTML content formatting for carriage returns.
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td><table border="1">
<tbody>
<tr>
<th>Escape sequence</th>
<th>Description</th>
</tr>
<tr>
<td><span class="literal">\b</span></td>
<td>Backspace</td>
</tr>
<tr>
<td><span class="literal">\t</span></td>
<td>Horizontal tab</td>
</tr>
<tr>
<td><span class="literal">\n</span></td>
<td>Line feed (new line)</td>
</tr>
<tr>
<td><span class="literal">\v</span></td>
<td>Vertical tab</td>
</tr>
<tr>
<td><span class="literal">\f</span></td>
<td>Form feed</td>
</tr>
<tr>
<td><span class="literal">\r</span></td>
<td>Carriage return</td>
</tr>
<tr>
<td><span class="literal">\"</span></td>
<td>Double quote "</td>
</tr>
<tr>
<td><span class="literal">\'</span></td>
<td>Single quote '</td>
</tr>
<tr>
<td><span class="literal">\\</span></td>
<td>Backslash</td>
</tr>
</tbody>
</table></td>
</tr>
</table>
</div>
<div id="-">
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
<tr>
<td valign="top" class="name">&mdash;</td>
<td valign="top" nowrap class="compatibility">NN <span class="emphasis">2</span> IE <span class="emphasis">3</span> ECMA <span class="emphasis">1</span>&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" nowrap class="usage"><p class="literal">
</p></td>
<td valign="top" nowrap class="requirements">&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="description"><p>
The decrement operator (a unary operator) subtracts 1 from the
current value of a variable expression. You can place the operator in
front of or behind the variable for a different effect. When the
operator is in front of the variable, the variable is decremented
before it is evaluated in the current statement. For example, in the
following sequence:
</p>
<span class="PROGRAMLISTING"><pre>var a, b;
a = 5;
b = --a;</pre></span>
</td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2"><p>
one is subtracted from <span class="literal">a</span> before being assigned to <span class="literal">b</span>. Therefore, both <span class="literal">b</span> and <span class="literal">a</span> are 4 when these statements finish running. In
contrast, in the following sequence:
</p>
<span class="PROGRAMLISTING"><pre>var a, b;
a = 5;
b = a--;</pre></span>
</td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2"><p>
the subtraction occurs after <span class="literal">a</span> is assigned to <span class="literal">b</span>. When the statements complete, <span class="literal">b</span> is 5 and <span class="literal">a</span> is 4.
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2"><p>
This behavior impacts the way <span class="literal">for</span>-loop-counting
variables are defined and used. Typically, a loop counter that counts
backwards from a maximum value decrements the counter after the
statements in the loop have run. Thus most loop counters place the
operator after the counter variable:
</p>
<span class="PROGRAMLISTING"><pre>for (var i = 10; i&gt;=0; i--) {...} </pre></span>
</td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="example"><span class="title">Example</span></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td><span class="programlisting">
<pre>--n
n--</pre>
</span></td>
</tr>
</table>
</div>
<div id="delete">
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
<tr>
<td valign="top" class="name">delete</td>
<td valign="top" nowrap class="compatibility">NN <span class="emphasis">4</span> IE <span class="emphasis">4</span> ECMA <span class="emphasis">1</span>&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" nowrap class="usage"><p class="literal">
</p></td>
<td valign="top" nowrap class="requirements">&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="description"><p>
The <span class="literal">delete</span> operator removes a property from an
object (e.g., a prototype property from an instance of an object to
whose static object your script added the prototype earlier) or an
item from a script-generated array. Removing an array entry does not
alter the array's length or the numerical indexes of
existing items. Instead, the value of the deleted item is simply <span class="literal">undefined</span>. The <span class="literal">delete</span> operator
is not a memory management tool.
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="example"><span class="title">Example</span></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td><span class="programlisting">
<pre>delete myString.author;</pre>
</span></td>
</tr>
</table>
</div>
<div id="/">
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
<tr>
<td valign="top" class="name">/</td>
<td valign="top" nowrap class="compatibility">NN <span class="emphasis">2</span> IE <span class="emphasis">3</span> ECMA <span class="emphasis">1</span>&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" nowrap class="usage"><p class="literal">
</p></td>
<td valign="top" nowrap class="requirements">&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="description"><p>
The division operator divides the number to the left of the operator
by the number to the right. Both operands must be numbers. An
expression with this operator evaluates to a number.
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="example"><span class="title">Example</span></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td><span class="programlisting">
<pre>var myQuotient = number1 / number2;</pre>
</span></td>
</tr>
</table>
</div>
<div id="do/while">
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
<tr>
<td valign="top" class="name">do/while</td>
<td valign="top" nowrap class="compatibility">NN <span class="emphasis">4</span> IE <span class="emphasis">4</span> ECMA <span class="emphasis">3</span>&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" nowrap class="usage"><p class="literal">
</p></td>
<td valign="top" nowrap class="requirements">&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="description"><p>
Executes statements in a loop while a condition is true. Because the
condition is tested at the end of the loop, the statements inside it
are always executed at least one time. It is imperative that the
expression that makes up the condition have some aspect of its value
potentially altered in the statements. Otherwise, an infinite loop
occurs.
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="example"><span class="title">Example</span></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td><span class="programlisting">
<pre>var i = 1;
do {
    window.status = "Loop number " + i++;
} while (i &lt;= 10)
window.status = "";</pre>
</span></td>
</tr>
</table>
</div>
<div id="==">
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
<tr>
<td valign="top" class="name">==</td>
<td valign="top" nowrap class="compatibility">NN <span class="emphasis">2</span> IE <span class="emphasis">3</span> ECMA <span class="emphasis">1</span>&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" nowrap class="usage"><p class="literal">
</p></td>
<td valign="top" nowrap class="requirements">&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="description"><p>
The equality operator compares two operand values and returns a
Boolean result. The behavior of this operator differs with the
version of JavaScript specified for the <span class="literal">script</span> element. If the <span class="literal">language</span> attribute is set to <span class="literal">JavaScript</span> or <span class="literal">JavaScript1.1</span>,
some operands are automatically converted as shown in the following
table.
</p>
<table border="1">
<tbody>
<tr>
<th>Left operand</th>
<th>Right operand</th>
<th>Description</th>
</tr>
<tr>
<td>Object reference</td>
<td>Object reference</td>
<td>Compare evaluation of object references.</td>
</tr>
<tr>
<td>Any data type</td>
<td>Boolean</td>
<td>Convert Boolean operand to a number (<span class="literal">1</span> for <span class="literal">true</span>; <span class="literal">0</span> for <span class="literal">false</span>) and compare against other operand. </td>
</tr>
<tr>
<td>Object reference</td>
<td>String</td>
<td>Convert object to string (via <span class="literal">toString( )</span>) and
compare strings. </td>
</tr>
<tr>
<td>String</td>
<td>Number</td>
<td>Convert string to a number and compare numeric values.</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2"><p>
Navigator 4 and later observes slightly different value conversions
for determining equality when you explicitly set the <span class="literal">script</span> element to <span class="literal">language="JavaScript1.2"</span>. The browser is more
literal about equality, meaning that no automatic data conversions
are performed. Therefore, whereas the expression:
</p>
<span class="PROGRAMLISTING"><pre>123 == &quot;123&quot;</pre></span>
</td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2"><p>
evaluates to <span class="literal">true</span> in most situations due to
automatic data type conversion, the expression evaluates to <span class="literal">false</span> in Navigator 4 and later but only in
statements belonging to explicitly JavaScript 1.2 scripts. Because
newer DOM and XHTML standards don't provide a place
to specify scripting language versions, you should avoid these
special-case situations. If your scripts require tests for absolute
equality of operands, use the newer <span class="literal">===</span> identity
operator instead. For typical value equality testing, the standard
equality operators work perfectly well.
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2"><p>
Regardless of version, if you wish to compare the values of objects
(for example, comparing strings explicitly generated with the <span class="literal">new</span> <span class="literal">String( )</span> constructor), you
should compare the values derived from methods such as <span class="literal">toString( )</span> or <span class="literal">valueOf( )</span>.
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="example"><span class="title">Example</span></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td><span class="programlisting">
<pre>if (n == m) {
    ...
}</pre>
</span></td>
</tr>
</table>
</div>
<div id=">=">
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
<tr>
<td valign="top" class="name">&gt;=</td>
<td valign="top" nowrap class="compatibility">NN <span class="emphasis">2</span> IE <span class="emphasis">3</span> ECMA <span class="emphasis">1</span>&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" nowrap class="usage"><p class="literal">
</p></td>
<td valign="top" nowrap class="requirements">&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="description"><p>
The greater-than-or-equal operator compares the values of operands on
either side of the operator. If the numeric value of the left operand
is larger than or equal to the right operand, the expression
evaluates to <span class="literal">true</span>. Strings are converted to their
Unicode values for comparison of those numeric values.
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="example"><span class="title">Example</span></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td><span class="programlisting">
<pre>if (a &gt;= b) {
    ...
}</pre>
</span></td>
</tr>
</table>
</div>
<div id=">">
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
<tr>
<td valign="top" class="name">&gt;</td>
<td valign="top" nowrap class="compatibility">NN <span class="emphasis">2</span> IE <span class="emphasis">3</span> ECMA <span class="emphasis">1</span>&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" nowrap class="usage"><p class="literal">
</p></td>
<td valign="top" nowrap class="requirements">&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="description"><p>
The greater-than operator compares the values of operands on either
side of the operator. If the numeric value of the left operand is
larger than the right operand, the expression evaluates to <span class="literal">true</span>. Strings are converted to their Unicode
values for comparison of those values.
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="example"><span class="title">Example</span></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td><span class="programlisting">
<pre>if (a &gt; b) {
    ...
}</pre>
</span></td>
</tr>
</table>
</div>
<div id="if">
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
<tr>
<td valign="top" class="name">if</td>
<td valign="top" nowrap class="compatibility">NN <span class="emphasis">2</span> IE <span class="emphasis">3</span> ECMA <span class="emphasis">1</span>&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" nowrap class="usage"><p class="literal">
</p></td>
<td valign="top" nowrap class="requirements">&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="description"><p>
This is a simple conditional statement that provides one alternate
execution path.
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="example"><span class="title">Example</span></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td><span class="programlisting">
<pre>if (myDateObj.getMonth( ) == 1) {
    calcMonthLength( );
}</pre>
</span></td>
</tr>
</table>
</div>
<div id="if/else">
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
<tr>
<td valign="top" class="name">if/else</td>
<td valign="top" nowrap class="compatibility">NN <span class="emphasis">2</span> IE <span class="emphasis">3</span> ECMA <span class="emphasis">1</span>&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" nowrap class="usage"><p class="literal">
</p></td>
<td valign="top" nowrap class="requirements">&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="description"><p>
This is a conditional statement that provides two execution paths
depending on the result of the condition. You can nest another <span class="literal">if</span> or <span class="literal">if</span>/<span class="literal">else</span> statement inside either
path of the <span class="literal">if</span>/<span class="literal">else</span> statement.
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="example"><span class="title">Example</span></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td><span class="programlisting">
<pre>var theMonth = myDateObj.getMonth( );
if (theMonth == 1) {
    monLength = calcLeapMonthLength( );
} else {
    monLength = calcMonthLength(theMonth);
}</pre>
</span></td>
</tr>
</table>
</div>
<div id="in">
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
<tr>
<td valign="top" class="name">in</td>
<td valign="top" nowrap class="compatibility">NN <span class="emphasis">6</span> IE <span class="emphasis">5.5(Win)</span> ECMA <span class="emphasis">n/a</span>&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" nowrap class="usage"><p class="literal">
</p></td>
<td valign="top" nowrap class="requirements">&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="description"><p>
The <span class="literal">in</span> operator lets scripts quickly uncover
whether an object has a particular property or method implemented for
it. The left operand is a string containing the name of the property
or method (method name without parentheses), while the right operand
is a reference to the object. If your exploration requires DOM
references entailing "dots," put
them in the object reference side of the expression. In other words,
instead of trying <span class="literal">"style.filter" in</span> <span class="literal">document.body</span>, use <span class="literal">"filter" in
document.body.style</span>. Were it not that so few browsers
implement this future ECMA operator, it would be a useful tool in
object detection.
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="example"><span class="title">Example</span></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td><span class="programlisting">
<pre>if ("createDocument" in document.implementation) {
    // go ahead and use document.implementation.createDocument( )
}</pre>
</span></td>
</tr>
</table>
</div>
<div id="++">
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
<tr>
<td valign="top" class="name">++</td>
<td valign="top" nowrap class="compatibility">NN <span class="emphasis">2</span> IE <span class="emphasis">3</span> ECMA <span class="emphasis">1</span>&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" nowrap class="usage"><p class="literal">
</p></td>
<td valign="top" nowrap class="requirements">&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="description"><p>
The increment operator (a unary operator) adds 1 to the current value
		of a variable expression. You can place the operator in front of or
		behind the variable for a different effect. When the operator is in
		front of the variable, the variable is incremented before it is
		evaluated in the current statement. For example, in the following
		sequence:
</p>
<span class="PROGRAMLISTING"><pre>var a, b;
a = 5;
b = ++a;</pre></span>
</td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2"><p>
1 is added to <span class="literal">a</span> before being assigned to <span class="literal">b</span>. Therefore, both <span class="literal">b</span> and <span class="literal">a</span> are 6 when these statements finish running. In contrast, in the following sequence:
</p>
<span class="PROGRAMLISTING"><pre>var a, b;
a = 5;
b = a++;</pre></span>
</td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2"><p>
the addition occurs after <span class="literal">a</span> is assigned to <span class="literal">b</span>. When these statements complete, <span class="literal">b</span> is 5 and <span class="literal">a</span> is 6.
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2"><p>
This behavior impacts the way <span class="literal">for</span>-loop-counting
		variables are defined and used. Typically, a loop counter that counts
		upward from a minimum value increments the counter after the
		statements in the loop have run. Thus, most loop counters place the
		operator after the counter variable:
</p>
<programlisting>for (var i = 10; i&gt;=0; i++) {...} </programlisting>
</td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="example"><span class="title">Example</span></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td><span class="programlisting">
<pre>++n
		n++</pre>
</span></td>
</tr>
</table>
</div>
<div id="!=">
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
<tr>
<td valign="top" class="name"><span class="emphasis">!</span>=</td>
<td valign="top" nowrap class="compatibility">NN <span class="emphasis">2</span> IE <span class="emphasis">3</span> ECMA <span class="emphasis">1</span>&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" nowrap class="usage"><p class="literal">
</p></td>
<td valign="top" nowrap class="requirements">&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="description"><p>
The inequality operator compares two operand values and returns a
Boolean result. The behavior of this operator differs with the
version of JavaScript specified for the <span class="literal">script</span> element. If the <span class="literal">language</span> attribute is set to <span class="literal">JavaScript</span> or <span class="literal">JavaScript1.1</span>,
some operands are automatically converted as for the equality
(<span class="literal">==</span>) operator. The situation is a bit different in
Navigator 4 or later when the <span class="literal">script</span> element is
set to <span class="literal">language="JavaScript1.2"</span>. The browser is
more literal about inequality, meaning that no automatic data
conversions are performed. Therefore, whereas the expression:
</p>
<span class="PROGRAMLISTING"><pre>123 != &quot;123&quot;</pre></span>
</td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2"><p>
evaluates to <span class="literal">false</span> in most situations due to
automatic data type conversion, the expression evaluates to <span class="literal">true</span> in Navigator 4 and later in statements
belonging to explicitly JavaScript 1.2 scripts. Because newer DOM and
XHTML standards don't provide a place to specify
scripting language versions, you should avoid these special-case
situations. If your scripts require tests for absolute inequality of
operands, use the newer <span class="literal">!==</span> identity operator
instead. For typical value inequality testing, the standard
inequality operators work perfectly well.
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2"><p>
Regardless of version, if you wish to compare the values of objects
(for example, strings explicitly generated with the <span class="literal">new</span> <span class="literal">String( )</span> constructor), you
should compare the values derived from methods such as <span class="literal">toString( )</span> or <span class="literal">valueOf( )</span>.
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="example"><span class="title">Example</span></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td><span class="programlisting">
<pre>if (n != m) {
    ...
}</pre>
</span></td>
</tr>
</table>
</div>
<div id="instanceof">
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
<tr>
<td valign="top" class="name">instanceof</td>
<td valign="top" nowrap class="compatibility">NN <span class="emphasis">6</span> IE <span class="emphasis">5(Win)</span> ECMA <span class="emphasis">n/a</span>&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" nowrap class="usage"><p class="literal">
</p></td>
<td valign="top" nowrap class="requirements">&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="description"><p>
The <span class="literal">instanceof</span> operator lets scripts determine if
an object (the left operand) is an instance of a known object (or
inherited from the known object). In some ways, this operator is like
the <span class="literal">typeof</span> operator, but rather than returning a
broad object type, an expression with the <span class="literal">instanceof</span> operator returns a Boolean value
against your test for a more specific object type. In fact, you can
query an object against custom objects and, in Netscape 6, W3C DOM
tree object prototypes. Whereas the <span class="literal">typeof</span> operator on an array returns <span class="literal">object</span>, you can find
out if an object was instantiated specifically as an array:
</p>
<span class="PROGRAMLISTING"><pre>myVar instanceof Array</pre></span>
</td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2"><p>
Note, however, that if the above expression evaluates to <span class="literal">true</span>, so does:
</p>
<span class="PROGRAMLISTING"><pre>myVar instanceof Object</pre></span>
</td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2"><p>
An array is a descendant of the root <span class="literal">Object</span> object, and is thus an instance of that root object, as well.
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2"><p>
In Netscape 6, either or both operands can also be references to DOM
prototype objects. Therefore, the following expression is legal and
operational in Netscape 6:
</p>
<span class="PROGRAMLISTING"><pre>document.getElementById(&quot;widget&quot;) instanceof HTMLDivElement </pre></span>
</td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="example"><span class="title">Example</span></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td><span class="programlisting">
<pre>if (theVal instanceof Array) {
    // go ahead and treat theVal as an array
}</pre>
</span></td>
</tr>
</table>
</div>
<div id="<=">
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
<tr>
<td valign="top" class="name">&lt;=</td>
<td valign="top" nowrap class="compatibility">NN <span class="emphasis">2</span> IE <span class="emphasis">3</span> ECMA <span class="emphasis">1</span>&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" nowrap class="usage"><p class="literal">
</p></td>
<td valign="top" nowrap class="requirements">&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="description"><p>
The less-than-or-equal operator compares the values of operands on
either side of the operator. If the numeric value of the left operand
is smaller than or equal to the right operand, the expression
evaluates to <span class="literal">true</span>. Strings are converted to their
Unicode values for comparison of those numeric values.
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="example"><span class="title">Example</span></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td><span class="programlisting">
<pre>if (a &lt;= b) {
    ...
}</pre>
</span></td>
</tr>
</table>
</div>
<div id="<">
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
<tr>
<td valign="top" class="name">&lt;</td>
<td valign="top" nowrap class="compatibility">NN <span class="emphasis">2</span> IE <span class="emphasis">3</span> ECMA <span class="emphasis">1</span>&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" nowrap class="usage"><p class="literal">
</p></td>
<td valign="top" nowrap class="requirements">&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="description"><p>
The less-than operator compares the values of operands on either side
of the operator. If the numeric value of the left operand is smaller
than the right operand, the expression evaluates to <span class="literal">true</span>. Strings are converted to their Unicode
values for comparison of those values.
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="example"><span class="title">Example</span></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td><span class="programlisting">
<pre>if (a &lt; b) {
    ...
}</pre>
</span></td>
</tr>
</table>
</div>
<div id="%">
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
<tr>
<td valign="top" class="name">%</td>
<td valign="top" nowrap class="compatibility">NN <span class="emphasis">2</span> IE <span class="emphasis">3</span> ECMA <span class="emphasis">1</span>&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" nowrap class="usage"><p class="literal">
</p></td>
<td valign="top" nowrap class="requirements">&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="description"><p>
The modulus operator divides the number to the left of the operator
by the number to the right. If a remainder exists after the division,
the expression evaluates to that remainder as an integer. If there is
no remainder, the returned value is zero. Both operands must be
numbers. An expression with this operator evaluates to a number. Even
if you aren't interested in the remainder value,
this operator is a quick way to find out if two values are evenly
divisible.
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="example"><span class="title">Example</span></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td><span class="programlisting">
<pre>if ((dayCount % 7) &gt; 0) {
    ...
}</pre>
</span></td>
</tr>
</table>
</div>
<div id="*">
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
<tr>
<td valign="top" class="name">*</td>
<td valign="top" nowrap class="compatibility">NN <span class="emphasis">2</span> IE <span class="emphasis">3</span> ECMA <span class="emphasis">1</span>&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" nowrap class="usage"><p class="literal">
</p></td>
<td valign="top" nowrap class="requirements">&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="description"><p>
The multiplication operator multiplies the number to the left of the
operator by the number to the right. Both operands must be numbers.
An expression with this operator evaluates to a number.
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="example"><span class="title">Example</span></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td><span class="programlisting">
<pre>var myProduct = <var class="replaceable">number1</var> * <var class="replaceable">number2</var>;</pre>
</span></td>
</tr>
</table>
</div>
<div id="-">
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
<tr>
<td valign="top" class="name">-</td>
<td valign="top" nowrap class="compatibility">NN <span class="emphasis">2</span> IE <span class="emphasis">3</span> ECMA <span class="emphasis">1</span>&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" nowrap class="usage"><p class="literal">
</p></td>
<td valign="top" nowrap class="requirements">&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="description"><p>
This is the negation operator. This unary operator negates the value
		of the single operand. For example, in the following statements:
</p>
<span class="PROGRAMLISTING"><pre>a = 5;
b = -a;</pre></span>
</td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2"><p>
the value of <span class="literal">b</span> becomes -5. A negation operator
		applied to a negative value returns a positive value.
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="example"><span class="title">Example</span></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td><span class="programlisting">
<pre>var myOpposite = -me;</pre>
</span></td>
</tr>
</table>
</div>
<div id="new">
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
<tr>
<td valign="top" class="name">new</td>
<td valign="top" nowrap class="compatibility">NN <span class="emphasis">2</span> IE <span class="emphasis">3</span> ECMA <span class="emphasis">1</span>&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" nowrap class="usage"><p class="literal">
</p></td>
<td valign="top" nowrap class="requirements">&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="description"><p>
The <span class="literal">new</span> operator creates instances of the
following ECMA standard static objects:
</p>
<ul>
<li><span class="LITERAL">Array</span></li>

<li><span class="LITERAL">Boolean</span></li>

<li><span class="LITERAL">Date</span></li>

<li><span class="LITERAL">Function</span></li>

<li><span class="LITERAL">Number</span></li>

<li><span class="LITERAL">Object</span></li>

<li><span class="LITERAL">RegExp</span></li>

<li><span class="LITERAL">String</span></li>
</ul></td>
</tr>
<tr>
<td colspan="2"><p>
An expression with this operator evaluates to an instance of the
object. In other words, invoking this operator makes JavaScript look
for a constructor function with the same name. Thus, the <span class="literal">new</span> operator also works with custom objects that
are formed via custom constructor functions. It also works in IE for
Windows for creating instances of proprietary objects, such as
ActiveX and VBArray objects.
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2"><p>
Syntax rules allow naming the static object, the static object with
empty parentheses, and the static object with parameters in
parentheses:
</p>
<span class="PROGRAMLISTING"><pre>var myArray = new Array;
var myArray = new Array( );
var myArray = new Array(&quot;Larry&quot;, &quot;Moe&quot;, &quot;Curly&quot;);</pre></span>
</td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2"><p>
Only the last two examples are guaranteed to work in all scriptable
browser versions. With the exception of the <span class="literal">Date</span> object, if you omit assigning parameters during the native object
creation, the newly minted instance has only the properties that are
assigned to the prototype of the static object.
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="example"><span class="title">Example</span></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td><span class="programlisting">
<pre>var now = new Date( );</pre>
</span></td>
</tr>
</table>
</div>
<div id="!">
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
<tr>
<td valign="top" class="name"><span class="emphasis">!</span></td>
<td valign="top" nowrap class="compatibility">NN <span class="emphasis">2</span> IE <span class="emphasis">3</span> ECMA <span class="emphasis">1</span>&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" nowrap class="usage"><p class="literal">
</p></td>
<td valign="top" nowrap class="requirements">&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="description"><p>
This is the NOT operator. This unary operator evaluates to the
negative value of a single Boolean operand. The NOT operator should
be used with explicit Boolean values, such as the result of a
comparison or a Boolean property setting.
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="example"><span class="title">Example</span></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td><span class="programlisting">
<pre>if (a == !b) {
    ...
}</pre>
</span></td>
</tr>
</table>
</div>
<div id="||">
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
<tr>
<td valign="top" class="name">||</td>
<td valign="top" nowrap class="compatibility">NN <span class="emphasis">2</span> IE <span class="emphasis">3</span> ECMA <span class="emphasis">1</span>&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" nowrap class="usage"><p class="literal">
</p></td>
<td valign="top" nowrap class="requirements">&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="description"><p>
The OR operator compares two Boolean expressions for equality. If
either or both expressions evaluate to <span class="literal">true</span>, the
result of the <span class="literal">||</span> operator also evaluates to <span class="literal">true</span>; if both expressions are <span class="literal">false</span>, the <span class="literal">||</span> operator
evaluates to <span class="literal">false</span>. A Boolean expression may
consist of a comparison expression (using any of the many comparison
operators) or a variety of other values. See the discussion of the
AND operator for a summary of the most common data types, values, and
their Boolean value equivalent.
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2"><p>
You can create compound conditions with the help of the <span class="literal">||</span> operator. For example, if you want to see if
either or both of two conditions are true, you would create a
condition such as the following:
<span class="PROGRAMLISTING"><pre>var userEntry1 = document.forms[0].entry1.value;
var userEntry2 = document.forms[0].entry2.value;
if (userEntry1 || userEntry2) {
    ...
}</pre></span>
</p>
</td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2"><p>
In the compound condition, the <span class="literal">||</span> operator wants
to know if either or both operands is <span class="literal">true</span> before
it evaluates to <span class="literal">true</span>. If the user entered text
into the first field, the condition short-circuits because a <span class="literal">true</span> value of either operand yields a <span class="literal">true</span> result. If text were entered only in the
second field, the second operand is evaluated. Because it evaluates
to <span class="literal">true</span> (a nonempty string), the condition
evaluates to <span class="literal">true</span>. Only when both operands
evaluate to <span class="literal">false</span> does the compound condition
evaluate to <span class="literal">false</span>.
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="example"><span class="title">Example</span></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td><span class="programlisting">
<pre>if (a &lt;= b || b &gt;= c) {
    ...
}</pre>
</span></td>
</tr>
</table>
</div>
<div id="===">
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
<tr>
<td valign="top" class="name">===</td>
<td valign="top" nowrap class="compatibility">NN <span class="emphasis">4</span> IE <span class="emphasis">4</span> ECMA <span class="emphasis">2</span>&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" nowrap class="usage"><p class="literal">
</p></td>
<td valign="top" nowrap class="requirements">&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="description"><p>
The strictly equals (identity) operator compares two operand values
and returns a Boolean result. Both the value and data type of the two
operands must be identical for this operator to return <span class="literal">true</span> (no automatic data type conversions occur).
See the equality operator (<span class="literal">==</span>) for more liberal
equality comparisons.
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="example"><span class="title">Example</span></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td><span class="programlisting">
<pre>if (n === m) {
    ...
}</pre>
</span></td>
</tr>
</table>
</div>
<div id="!==">
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
<tr>
<td valign="top" class="name"><span class="emphasis">!</span>==</td>
<td valign="top" nowrap class="compatibility">NN <span class="emphasis">4</span> IE <span class="emphasis">4</span> ECMA <span class="emphasis">n/a</span>&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" nowrap class="usage"><p class="literal">
</p></td>
<td valign="top" nowrap class="requirements">&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="description"><p>
The strict-not-equals (nonidentity) operator compares two operand
values and returns a Boolean result. Both the value and data type of
the two operands must be identical for this operator to return <span class="literal">false</span>. For less stringent comparisons, see the
inequality operator (<span class="literal">!=</span>).
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="example"><span class="title">Example</span></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td><span class="programlisting">
<pre>if (n !== m) {
    ...
}</pre>
</span></td>
</tr>
</table>
</div>
<div id="for">
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
<tr>
<td valign="top" class="name">for</td>
<td valign="top" nowrap class="compatibility">NN <span class="emphasis">2</span> IE <span class="emphasis">3</span> ECMA <span class="emphasis">1</span>&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" nowrap class="usage"><p class="literal">
</p></td>
<td valign="top" nowrap class="requirements">&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="description"><p>
This is a construction that allows repeated execution of statements,
usually for a controlled number of times.
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="example"><span class="title">Example</span></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td><span class="programlisting">
<pre>var userEntry = document.forms[0].entry.value;
var oneChar;
for (var i = 0; i &lt; userEntry.length; i++) {
    oneChar = userEntry.charAt(i);
    if (oneChar &lt; "0" || oneChar &gt; "9") {
        alert("The entry must be numerals only.");
    }
}</pre>
</span></td>
</tr>
</table>
</div>
<div id="for/in">
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
<tr>
<td valign="top" class="name">for/in</td>
<td valign="top" nowrap class="compatibility">NN <span class="emphasis">2</span> IE <span class="emphasis">3</span> ECMA <span class="emphasis">1</span>&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" nowrap class="usage"><p class="literal">
</p></td>
<td valign="top" nowrap class="requirements">&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="description"><p>
This is a variation of the regular <span class="literal">for</span> loop that
can extract the property names and values of an object. Only
properties (and, in Netscape 6, methods) that are set to be
enumerable by the browser internals appear in the output of this
construction. Opera 6 supports this construction only for custom
script-generated objects.
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="example"><span class="title">Example</span></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td><span class="programlisting">
<pre>function showProps( ) {
    objName = "image";
    obj = document.images[0];
    var msg = "";
    for (var i in obj) {
        msg += objName + "." + i + "=" + obj[i] + "\n";
    }
    alert(msg);
}</pre>
</span></td>
</tr>
</table>
</div>
<div id="-">
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
<tr>
<td valign="top" class="name">-</td>
<td valign="top" nowrap class="compatibility">NN <span class="emphasis">2</span> IE <span class="emphasis">3</span> ECMA <span class="emphasis">1</span>&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" nowrap class="usage"><p class="literal">
</p></td>
<td valign="top" nowrap class="requirements">&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="description"><p>
The subtraction operator subtracts the number to the right of the
operator from the number on the left. Both operands must be numbers.
An expression with this operator evaluates to a number.
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="example"><span class="title">Example</span></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td><span class="programlisting">
<pre>var myDifference = <var class="replaceable">number1</var> - <var class="replaceable">number2</var>;</pre>
</span></td>
</tr>
</table>
</div>
<div id="switch/case">
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
<tr>
<td valign="top" class="name">switch/case</td>
<td valign="top" nowrap class="compatibility">NN <span class="emphasis">4</span> IE <span class="emphasis">4</span> ECMA <span class="emphasis">3</span>&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" nowrap class="usage"><p class="literal">
</p></td>
<td valign="top" nowrap class="requirements">&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="description"><p>
Provides a shortcut to execution paths for numerous conditions of an
expression. The optional <span class="literal">break</span> statement at the
end of each <span class="literal">case</span> block shortcuts execution of the <span class="literal">switch</span> statement, and also prevents the
inadvertent execution of the <span class="literal">default</span> block, if
present.
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="example"><span class="title">Example</span></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td><span class="programlisting">
<pre>var productList = document.forms[0].prodList;
var chosenItem = productList.options[productList.selectedIndex].value;
switch(chosenItem) {
    case "Small Widget":
        document.forms[0].price.value = "44.95";
        break;
    case "Medium Widget":
        document.forms[0].price.value = "54.95";
        break;
    case "Large Widget":
        document.forms[0].price.value = "64.95";
        break;
    default:
        document.forms[0].price.value = "Nothing Selected";
}</pre>
</span></td>
</tr>
</table>
</div>
<div id="this">
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
<tr>
<td valign="top" class="name">this</td>
<td valign="top" nowrap class="compatibility">NN <span class="emphasis">2</span> IE <span class="emphasis">3</span> ECMA <span class="emphasis">1</span>&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" nowrap class="usage"><p class="literal">
</p></td>
<td valign="top" nowrap class="requirements">&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="description"><p>
Refers to the current object. For example, in a form control object
event handler, you can pass the object as a parameter to the
function:
</p>
<span class="PROGRAMLISTING"><pre>&lt;input type=&quot;text&quot; name=&quot;ZIP&quot; onchange=&quot;validate(this);&gt;&quot;</pre></span>
</td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2"><p>
Inside a custom object constructor, the keyword refers to the object
itself, allowing you to assign values to its properties (even
creating the properties at the same time):
</p>
<span class="PROGRAMLISTING"><pre>function CD(label, num, artist) {
    this.label = label;
    this.num = num;
    this.artist = artist;
}</pre></span>
</td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2"><p>
Inside a function, the <span class="literal">this</span> keyword refers to the
function object. However, if the function is assigned as a method of
a custom object constructor, <span class="literal">this</span> refers to the
instance of the object in whose context the function executes.
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="example"><span class="title">Example</span></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td><span class="programlisting">
<pre>&lt;input type="text" name="phone" onchange="validate(this.value);"&gt;</pre>
</span></td>
</tr>
</table>
</div>
<div id="throw">
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
<tr>
<td valign="top" class="name">throw</td>
<td valign="top" nowrap class="compatibility">NN <span class="emphasis">6</span> IE <span class="emphasis">5</span> ECMA <span class="emphasis">3</span>&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" nowrap class="usage"><p class="literal">
</p></td>
<td valign="top" nowrap class="requirements">&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="description"><p>
Triggers an exception condition, passing a value along with the
exception. Although the value you pass can be a simple string,
ideally you should pass an instance of the JavaScript <span class="literal">Error</span> object filled with sufficient information
for a catch statement to act intelligently on the error. A <span class="literal">throw</span> statement must be enclosed in the <span class="literal">try</span> portion of a <span class="literal">try-catch</span> construction.
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="example"><span class="title">Example</span></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td><span class="programlisting">
<pre>function processNumber(inputField) {
    try {
        var inpVal = parseInt(inputField.value, 10);
        if (isNaN(inpVal)) {
            var msg = "Please enter a number only.";
            var err = new Error(msg);
            if (!err.message) {
                err.message = msg;
            }
            throw err;
        }
        // process number
    }
    catch (e) {
        alert(e.message);
        inputField.focus( );
        inputField.select( );
    }
}</pre>
</span></td>
</tr>
</table>
</div>
<div id="try/catch">
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
<tr>
<td valign="top" class="name">try/catch</td>
<td valign="top" nowrap class="compatibility">NN <span class="emphasis">6</span> IE <span class="emphasis">5</span> ECMA <span class="emphasis">3</span>&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" nowrap class="usage"><p class="literal">
</p></td>
<td valign="top" nowrap class="requirements">&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="description"><p>
This construction provides a nondisruptive way to trap for errors
(exceptions) and handle them gracefully. Both parts of this
exception-handling construction are required. If an error occurs in
the <span class="literal">try</span> portion, execution immediately branches to
the <span class="literal">catch</span> portion, where your scripts can display
alert dialogs, modify data, or any other task that keeps the
JavaScript interpreter from triggering a disruptive error message.
Exceptions that occur naturally (i.e., they are not thrown by a <span class="literal">throw</span> statement) pass an instance of the <span class="literal">Error</span> object as a parameter to the <span class="literal">catch</span> section. Statements inside the <span class="literal">catch</span> section can examine properties of the error
object to determine how to handle exceptions that land there. Thus,
one <span class="literal">catch</span> portion can handle errors of various
types.
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2"><p>
You can use <span class="literal">try</span>/<span class="literal">catch</span> constructions only in browsers that support them. To protect older
browsers from seeing this construction, place all affected code
inside a &lt;script&gt; tag that explicitly requires JavaScript 1.5
or later (with the <span class="literal">language = "JavaScript1.5"</span> attribute.
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="example"><span class="title">Example</span></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td><span class="programlisting">
<pre>function insertOneNode(baseNode, newNode, position) {
    try {
        baseNode.insertBefore(newNode, baseNode.childNodes[position]);
    }
    catch (e) {
        // handle W3C DOM Exception types
        switch (e.name) {
            case "HIERARCHY_REQUEST_ERR" :
                // process bad tree hierarchy reference
                break;
            case "NOT_FOUND_ERR" :
                // process bad refNode reference
                break;
            default :
                // process all other exceptions
        }
    }
    return true;
}</pre>
</span></td>
</tr>
</table>
</div>
<div id="typeof">
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
<tr>
<td valign="top" class="name">typeof</td>
<td valign="top" nowrap class="compatibility">NN <span class="emphasis">3</span> IE <span class="emphasis">3</span> ECMA <span class="emphasis">1</span>&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" nowrap class="usage"><p class="literal">
</p></td>
<td valign="top" nowrap class="requirements">&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="description"><p>
The <span class="literal">typeof</span> operator returns one of six string
descriptions of the data type of a value. Those returned types are:
</p>
<ul>
<li><span class="LITERAL">boolean</span></li>

<li><span class="LITERAL">function</span></li>

<li><span class="LITERAL">number</span></li>

<li><span class="LITERAL">object</span></li>

<li><span class="LITERAL">string</span></li>

<li><span class="LITERAL">undefined</span></li>
</ul>
</td>
</tr>
<tr>
<td colspan="2"><p>
The object type includes arrays, but the operator provides no further
information about the type of object or array of the value (see the <span class="literal">instanceof</span> operator).
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="example"><span class="title">Example</span></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td><span class="programlisting">
<pre>if (typeof someVar == "string") {
    ...
}</pre>
</span></td>
</tr>
</table>
</div>
<div id="void">
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
<tr>
<td valign="top" class="name">void</td>
<td valign="top" nowrap class="compatibility">NN <span class="emphasis">3</span> IE <span class="emphasis">4</span> ECMA <span class="emphasis">1</span>&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" nowrap class="usage"><p class="literal">
</p></td>
<td valign="top" nowrap class="requirements">&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="description"><p>
This unary operator evaluates the expression to its right but returns
a value of <span class="literal">undefined</span>, even if the expression (such
as a function call) evaluates to some value. This operator is
commonly used with <span class="literal">javascript:</span> pseudo-URLs that
invoke functions. If the function returns a value, that value is
ignored by the calling expression.
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="example"><span class="title">Example</span></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td><span class="programlisting">
<pre>&lt;a href="javascript: void getSound( );" &gt;...&lt;/a&gt;</pre>
</span></td>
</tr>
</table>
</div>
<div id="while">
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
<tr>
<td valign="top" class="name">while</td>
<td valign="top" nowrap class="compatibility">NN <span class="emphasis">2</span> IE <span class="emphasis">3</span> ECMA <span class="emphasis">1</span>&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" nowrap class="usage"><p class="literal">
</p></td>
<td valign="top" nowrap class="requirements">&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="description"><p>
Executes statements in a loop as long as a condition is true. Because
the condition is tested at the beginning of the loop, it is
conceivable that under the right conditions, the statements inside
the loop do not execute. It is imperative that the expression that
makes up the condition have some aspect of its value potentially
altered in the statements. Otherwise an infinite loop occurs.
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="example"><span class="title">Example</span></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td><span class="programlisting">
<pre>var i = 0;
while (!document.forms[0].radioGroup[i].checked) {
    i++;
}
alert("You selected item number " + (i+1) + ".");</pre>
</span></td>
</tr>
</table>
</div>
<div id="with">
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
<tr>
<td valign="top" class="name">with</td>
<td valign="top" nowrap class="compatibility">NN <span class="emphasis">2</span> IE <span class="emphasis">3</span> ECMA <span class="emphasis">1</span>&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" nowrap class="usage"><p class="literal">
</p></td>
<td valign="top" nowrap class="requirements">&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="description"><p>
The <span class="literal">with</span> statement adds an object to the scope of
every statement nested within. This can shorten the code of some
statement groups that rely on a particular object reference. Note
that <span class="literal">with</span> constructions are generally very
inefficient. You can achieve better performance by assigning the
object reference to a local variable, and using that variable in your
function.
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="example"><span class="title">Example</span></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td><span class="programlisting">
<pre>with (document.forms[0]) {
    name1 = firstName.value;
    name2 = lastName.value;
    mail = eMail.value;
}</pre>
</span></td>
</tr>
</table>
</div>
<div id="return">
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
<tr>
<td valign="top" class="name">return</td>
<td valign="top" nowrap class="compatibility">NN <span class="emphasis">2</span> IE <span class="emphasis">3</span> ECMA <span class="emphasis">1</span>&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" nowrap class="usage"><p class="literal">
</p></td>
<td valign="top" nowrap class="requirements">&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="description"><p>
Stops execution of the current function. A <span class="literal">return</span> statement can be located anywhere within the function, including
inside control structures. You can optionally specify a value to be
returned to the calling statement. This return value can be any
JavaScript data type. If a <span class="literal">return</span> statement that
returns a value is in a loop or other control structure, there must
be a <span class="literal">return</span> statement for each branch of the
execution tree, including a default <span class="literal">return</span> statement if execution should reach the main execution scope near or
at the end of the function.
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="example"><span class="title">Example</span></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td><span class="programlisting">
<pre>function validateNumber(form) {
    var oneChar;
    for (var i = 0; i &lt; userEntry.length; i++) {
        oneChar = form.entry.value.charAt(i);
        if (oneChar &lt; "0" || oneChar &gt; "9") {
            return false;
        }
    }
    return true;
}</pre>
</span></td>
</tr>
</table>
</div>
<div id="+=">
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
<tr>
<td valign="top" class="name">+=</td>
<td valign="top" nowrap class="compatibility">NN <span class="emphasis">2</span> IE <span class="emphasis">3</span> ECMA <span class="emphasis">1</span>&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" nowrap class="usage"><p class="literal">
</p></td>
<td valign="top" nowrap class="requirements">&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="description"><p>
This is the add-by-value operator. This class of operator combines a
		regular assignment operator (<span class="literal">=</span>) with one of the
		many other operators to carry out the assignment by performing the
		stated operation on the left operand with the value of the right
		operand. For example, if a variable named <span class="literal">a</span> has a
		string stored in it, you can append a string to <span class="literal">a</span> with the <span class="literal">+=</span> operator:
</p>
<span class="PROGRAMLISTING"><pre>a += &quot; and some more.&quot;;</pre></span>
</td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2"><p>
Without the add-by-value operator, the operation had to be structured
		as follows:
</p>
<span class="PROGRAMLISTING">
<pre>a = a + &quot; and some more&quot;;</pre>
</span> </td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2"><p>
The following table shows all the assignment operators that function
		this way.
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td><table border="1">
<tbody>
<tr>
<th>Operator</th>
<th>Example</th>
<th>Equivalent</th>
</tr>
<tr>
<td> +=</td>
<td> a += b</td>
<td> a = a + b</td>
</tr>
<tr>
<td> -=</td>
<td> a -= b</td>
<td> a = a - b</td>
</tr>
<tr>
<td> *=</td>
<td> a *= b</td>
<td> a = a * b</td>
</tr>
<tr>
<td> /=</td>
<td> a /= b</td>
<td> a = a / b</td>
</tr>
<tr>
<td> %=</td>
<td> a %= b</td>
<td> a = a % b</td>
</tr>
<tr>
<td>&lt;&lt;=</td>
<td> a &lt;&lt;= b</td>
<td> a = a &lt;&lt; b</td>
</tr>
<tr>
<td>&gt;&gt;=</td>
<td> a &gt;&gt;= b</td>
<td> a = a &gt;&gt; b</td>
</tr>
<tr>
<td>&gt;&gt;&gt;=</td>
<td> a &gt;&gt;&gt;= b</td>
<td> a = a &gt;&gt;&gt; b</td>
</tr>
<tr>
<td>&amp;=</td>
<td> a &amp;= b</td>
<td> a = a &amp; b</td>
</tr>
<tr>
<td> |=</td>
<td> a |= b</td>
<td> a = a | b</td>
</tr>
<tr>
<td> ^=</td>
<td> a ^= b</td>
<td> a = a ^ b</td>
</tr>
</tbody>
</table></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="example"><span class="title">Example</span></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td><span class="programlisting">
<pre>output += "&lt;H1&gt;Section 2&lt;/H1&gt;";
		total *= .95;</pre>
</span></td>
</tr>
</table>
</div>
<div id="+">
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
<tr>
<td valign="top" class="name">+</td>
<td valign="top" nowrap class="compatibility">NN <span class="emphasis">2</span> IE <span class="emphasis">3</span> ECMA <span class="emphasis">1</span>&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" nowrap class="usage"><p class="literal">
</p></td>
<td valign="top" nowrap class="requirements">&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="description"><p>
The addition operator works with both numbers and strings, but its
results vary with the data types of its operands. When both operands
are numbers, the result is the sum of the two numbers; when both
operands are strings, the result is a concatenation of the two
strings (in the order of the operands); when one operand is a number
and the other a string, the number data type is converted to a
string, and the two strings are concatenated. To convert a string
operand to a number, use the <span class="literal">parseInt( )</span> or <span class="literal">parseFloat( )</span> function.
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="example"><span class="title">Example</span></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td><span class="programlisting">
<pre>var mySum = number1 + number2;
var newString = "string1" + "string2";</pre>
</span></td>
</tr>
</table>
</div>
<div id="&&">
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
<tr>
<td valign="top" class="name">&amp;&amp;</td>
<td valign="top" nowrap class="compatibility">NN <span class="emphasis">2</span> IE <span class="emphasis">3</span> ECMA <span class="emphasis">1</span>&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" nowrap class="usage"><p class="literal">
</p></td>
<td valign="top" nowrap class="requirements">&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="description"><p>
The AND operator compares two Boolean expressions for equality. If
both expressions evaluate to <span class="literal">true</span>, the result of
the <span class="literal">&amp;&amp;</span> operator also evaluates to <span class="literal">true</span>; if either or both expressions are <span class="literal">false</span>, the <span class="literal">&amp;&amp;</span> operator
evaluates to <span class="literal">false</span>.
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2"><p>
A Boolean expression may consist of a comparison expression (using
any of the many comparison operators) or a variety of other values.
Here are the most common data types, values, and their Boolean value
equivalent.
</p>
<table border="1">
<tbody>
<tr>
<th>Data type</th>
<th>Boolean equivalent</th>
</tr>
<tr>
<td>Number other than zero</td>
<td> true</td>
</tr>
<tr>
<td>Zero</td>
<td> false</td>
</tr>
<tr>
<td>Any nonempty string</td>
<td> true</td>
</tr>
<tr>
<td>Empty string</td>
<td> false</td>
</tr>
<tr>
<td>Any object</td>
<td> true</td>
</tr>
<tr>
<td><span class="literal">null</span></td>
<td> false</td>
</tr>
<tr>
<td><span class="literal">undefined</span></td>
<td> false</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2"><p>
Using this information, you can create compound conditions with the
help of the <span class="literal">&amp;&amp;</span> operator. For example, if
you want to see if someone entered a value into a form field and it
is a number greater than 100, the condition would look like the
following:
</p>
<span class="PROGRAMLISTING"><pre>var userEntry = document.forms[0].entry.value ;
if (userEntry&amp;&amp; parseInt(userEntry) &gt;= 100) {
    ...
} </pre></span>
</td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2"><p>
If the user had not entered any value, the string would be an empty
string. In the compound condition, when the first operand evaluates
to <span class="literal">false</span>, the <span class="literal">&amp;&amp;</span> operator rules mean that the entire expression returns <span class="literal">false</span> (because both operands must be <span class="literal">true</span> for the operator to return <span class="literal">true</span>). Because evaluation of expressions such as
the compound condition are evaluated from left to right, the <span class="literal">false</span> value of the first operand short-circuits
the condition to return <span class="literal">false</span>, meaning that the
second operand isn't evaluated.
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="example"><span class="title">Example</span></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td><span class="programlisting">
<pre>if (a &lt;= b &amp;&amp; b &gt;= c) {
    ...
}</pre>
</span></td>
</tr>
</table>
</div>
<div id="break">
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
<tr>
<td valign="top" class="name">break</td>
<td valign="top" nowrap class="compatibility">NN <span class="emphasis">2</span> IE <span class="emphasis">3</span> ECMA <span class="emphasis">1</span>&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" nowrap class="usage"><p class="literal">
</p></td>
<td valign="top" nowrap class="requirements">&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="description"><p>
Stops execution of the current loop and returns control to the next
script statement following the end of the current loop. Note that
without a label parameter, the scope of the <span class="literal">break</span> statement is its own loop. To break out of a nested loop, assign
labels to each nested layer, and use the desired label as a parameter
with the <span class="literal">break</span> statement. See the <span class="literal">label</span> statement (available only starting with
Navigator 4 and Internet Explorer 4).
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="example"><span class="title">Example</span></td>
</tr>
<tr>
<td colspan="2"><p>
See the <span class="literal">label</span> statement.
</p></td>
</tr>
</table>
</div>
<div id="continue">
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
<tr>
<td valign="top" class="name">continue</td>
<td valign="top" nowrap class="compatibility">NN <span class="emphasis">2</span> IE <span class="emphasis">3</span> ECMA <span class="emphasis">1</span>&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" nowrap class="usage"><p class="literal">
</p></td>
<td valign="top" nowrap class="requirements">&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="description"><p>
Stops execution of the current iteration through the loop and returns
to the top of the loop for the next pass (executing the update
expression if one is specified in a <span class="literal">for</span> loop). If
you are using nested loop constructions, assign labels to each nested
layer, and use the desired label as a parameter with the <span class="literal">continue</span> statement. See the <span class="literal">label</span> statement (available only starting with
Navigator 4 and Internet Explorer 4).
</p></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="example"><span class="title">Example</span></td>
</tr>
<tr>
<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td><span class="programlisting">
<pre>outerLoop:
for (var i = 0; i &lt;= maxValue1; i++) {
    for (var j = 0; j &lt;= maxValue2; j++) {
        if (j*i == magic2) {
            continue outerLoop;
        }
    }
}</pre>
</span></td>
</tr>
</table>
</div>
<div id="catch">
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
<tr>
<td valign="top" class="name">catch</td>
<td valign="top" nowrap class="compatibility">NN <span class="emphasis">2</span> IE <span class="emphasis">3</span> ECMA <span class="emphasis">1</span>&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" nowrap class="usage"><p class="literal">
</p></td>
<td valign="top" nowrap class="requirements">&nbsp;&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="2" class="description"><p>
See try.
</p></td>
</tr>
</table>
</div>
</body>
</html>
