Java Reference
In-Depth Information
Object Operators
JavaScript provides a number of operators to work with objects. The following table lists them.
naMe
introduced
Meaning
JavaScript 1.2
delete
delete obj
Deletes an object, one of its properties, or the element of
an array at the specified index. Also deletes variables not
declared with the var keyword.
JavaScript 1.4
in
for (prop in somObj)
Returns true if someObj has the named property.
JavaScript 1.4
instanceof
someObj instanceof ObjType
Returns true if someObj is of type ObjType ; otherwise,
returns false .
JavaScript 1.0
new
new ObjType()
Creates a new instance of an object with type ObjType .
JavaScript 1.0
this
this.property
Refers to the current object.
Miscellaneous operators
The following table lists miscellaneous operators.
naMe
introduced
Meaning
Conditional operator
JavaScript 1.0
(evalquery) ? v1 : v2
If evalquery is true , the operator returns v1 ;
otherwise it returns v2 .
Comma operator
JavaScript 1.0
var v3 = (v1 + 2, v2 * 2)
Evaluates both operands while treating the two as
one expression. Returns the value of the second
operand. In this example, v3 holds the resulting
value of v2 * 2 .
JavaScript 1.1
typeof
typeof v1
Returns a string holding the type of v1 , which is not
evaluated.
JavaScript 1.1
void
void(eva1)
Evaluates eval1 but does not return a value.
Search WWH ::




Custom Search