
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
138
|
Chapter 5: Operators
Other Operators
The remaining operators apply to topics considered in other chapters. We’ll include
them here for quick reference only and describe their usage fully in those chapters.
The typeof Operator
The typeof operator is used to determine the datatype of an expression or identifier.
It takes one operand, as follows:
typeof operand
where operand can be any legal expression. The return value of the typeof operation is
a string indicating the datatype of the evaluated
operand. See Chapter 3 for more
details.
The new Operator
The new operator creates a new composite datum—either an array or an object. The
object can be a member of a built-in class or a user-defined class. The syntax for new
is:
new constructor
where constructor must be a function that defines the properties of the newly cre-
ated object. See Chapter 11, Chapter 12, and the Constructor headings in the Lan-
guage Reference.
The delete Operator
We use the delete operator to remove an object, an object property, an array ele-
ment, or variables from a script. The syntax for delete is:
delete identifier
If identifier is not a data container (i.e., a variable, property, or element), the delete
operation fails and returns the value
false; otherwise, it returns true, indicating suc-
cess. The delete operator ...