 | 
 Online
Companion Home
 Documents
HTML:
Tutorial 1
Tutorial 2
Tutorial 3
Tutorial 4
Tutorial 5
Tutorial 6
Tutorial 7
Tutorial 8
Tutorial 9
Tutorial 10
DHTML:
Tutorial 1
Tutorial 2
Tutorial 3
Tutorial 4
Tutorial 5
 Gallery
 Software
 Data Files

Reference:
HTML Tags
Appendix D:
JavaScript Objects,
Properties,
Methods,
Event Handlers
Appendix E: JavaScript Operators, Elements, Keywords
Appendix F:
Cascading Style Sheets

 |  |  | Online Companion Home Appendix E: Main
 Appendix E JavaScript Operators, Syntactical Elements, and Keywords
| JavaScript Operators | Description | IE | Netscape |
| Assignment | Operators used to assign values to variables |
|
|
= | Assigns the value of the variable on the right to the variable on the left
(x=y) |
3.0 |
2.0 |
+= | Adds the two variables and assigns the result to the variable on the left
(x+=y is equivalent to x=x+y) |
3.0 |
2.0 |
-= | Subtracts the variable on the right from the variable on the left and
assigns the result to the variable on the left (x-=y is equivalent to
x=x-y) |
3.0 |
2.0 |
*= | Multiplies the two variables together and assigns the result to the variable
on the left (x*=y is equivalent to x=x*y) |
3.0 |
2.0 |
/= | Divides the variable on the left by the variable on the right and assigns
the result to the variable on the left (x/=y is equivalent to x=x/y) |
3.0 |
2.0 |
&= | Combines two expressions into a single expression (x&=y is equivalent to
x=x&y) |
3.0 |
2.0 |
%= | Divides the variable on the left by the variable on the right and assigns
the remainder to the variable on the left (x%=y is equivalent to x=x%y) |
3.0 |
2.0 |
|

| JavaScript Operators | Description | IE | Netscape |
Arithmetic | Operators used for arithmetic functions |
|
|
+ | Adds two variables together (x+y) |
3.0 |
2.0 |
- | Subtracts the variable on the right from the variable on the left (x-y) |
3.0 |
2.0 |
* | Multiplies two variables together (x*y) |
3.0 |
2.0 |
/ | Divides the variable the left by the variable on the right (x/y) |
|
|
% | Calculates the remainder after dividing the variable on the left by the
variable on the right (x%y) |
3.0 |
2.0 |
++ | Increases the value of a variable by 1 (x++ is equivalent to x=x+1) |
3.0 |
2.0 |
& | Combines two expressions (x & y) |
3.0 |
2.0 |
-- | Decreases the value of variable by 1 (x-- is equivalent to x=x-1) |
3.0 |
2.0 |
- | Changes the sign of a variable (-x) |
3.0 |
2.0 |
|

| JavaScript Operators | Description | IE | Netscape |
Comparison | Operators used for comparing expressions |
|
|
== | Returns true when the two expressions are equal (x==y) |
3.0 |
2.0 |
!= | Returns true when the two expressions are not equal (x!=y) |
3.0 |
2.0 |
!== | Returns true when the values of the two expressions are equal (x!==y) |
5.0 |
5.0 |
> | Returns true when the expression on the left is greater than the expression
on the right (x > y) |
3.0 |
2.0 |
< | Returns true when the expression on the left is less than the expression on
the right (x < y) |
3.0 |
2.0 |
>= | Returns true when the expression on the left is greater than or equal to the
expression on the right (x >= y) |
3.0 |
2.0 |
<= | Returns true when the expression on the left is less than or equal to the
expression on the right (x <= y) |
3.0 |
2.0 |
|

| JavaScript Operators | Description | IE | Netscape |
Conditional | Operators used to determine values based on conditions that are either
true or false |
|
|
| (condition) ? value1 : value2 | If condition is true, then this expression equals value1,
otherwise it equals value2 |
|
|
|

| JavaScript Operators | Description | IE | Netscape |
Keywords |
JavaScript keywords are reserved by JavaScript |
|
|
infinity | Represents positive infinity (often used with comparison operators) |
5.0 |
4.0 |
this | Refers to the current object |
3.0 |
2.0 |
var | Declares a variable |
3.0 |
2.0 |
with | Allows the declaration of all the properties for an object without directly
referencing the object each time |
3.0 |
2.0 |
|

| JavaScript Operators | Description | IE | Netscape |
Logical |
Operators used for evaluating true and false expressions |
|
|
! | Reverses the Boolean value of the expression |
3.0 |
2.0 |
&& | Returns true only if both expressions are true (also known as an AND
operator) |
|
|
|| | Returns true when either expression is true (also known as an OR
operator) |
3.0 |
2.0 |
| | Returns true if the expression is false, and false if the expression is true
(also known as a NEGATION operator) |
3.0 |
2.0 |
|

| JavaScript Operators | Description | IE | Netscape |
Syntax |
Syntactical elements |
|
|
; | Indicates the end of a command line |
3.0 |
2.0 |
/* comments*/ | Used for inserting comments within a JavaScript command line |
3.0 |
2.0 |
// comments | Used to create a line of comments |
3.0 |
2.0 |
|


|  |