Course Technology logoCourse Technology
Appendix E

*
 Online 
    Companion 
 Home 

directory folder
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 


directory folder
Gallery 

directory folder
Software 


directory folder
Data Files 


directory folder
Reference: 

HTML Tags 

 Appendix D: 
 JavaScript 
 Objects, 
 Properties, 
 Methods, 
 Event 
 Handlers 

 Appendix E: 
JavaScript 
 Operators, 
 Elements, 
 Keywords 
  
 Appendix F: 
 Cascading 
 Style Sheets 



Web Pages and HTML icon

Online Companion Home * Appendix E: Main 
spacer

Appendix E
JavaScript Operators, Syntactical Elements,
and Keywords





JavaScript OperatorsDescriptionIENetscape
AssignmentOperators 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

To the top

JavaScript OperatorsDescriptionIENetscape

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

To the top

JavaScript OperatorsDescriptionIENetscape

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

To the top

JavaScript OperatorsDescriptionIENetscape

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



To the top

JavaScript OperatorsDescriptionIENetscape

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

To the top

JavaScript OperatorsDescriptionIENetscape

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

To the top

JavaScript OperatorsDescriptionIENetscape

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

To the top

*Appendix E:
JavaScript Operators, Syntactical Elements, and Keywords
Assignment,   Arithmetic,   Comparison,  
Conditional,   Keywords,   Logical,   Syntax


*Online Companion Home  
*Software  *Gallery  directory folderData Files  
*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

*Reference:  HTML Tags, Properties | Appendix D:Web Pages and HTML icon
JavaScript Objects, Properties, Methods, Event Handlers
Appendix E:  JavaScript Operators, Elements, Keywords
Appendix F:  Cascading Style Sheets

To the top

*
Website design by SKDesigns.Course Technology © 2000*
*