Java Reference
In-Depth Information
You can also create an object using object literal notation like this:
var obj = {};
Literal notation is the preferred method of creating an object.
Properties
Property
Introduced
Description
constructor
JavaScript 1.1
Used to reference the constructor function for the object.
prototype
JavaScript 1.1
Returns the prototype for the object, which can be used to
extend the object's interface.
Methods
Method
Introduced
Description
hasOwnProperty(propertyName)
JavaScript 1.5
Checks whether the specifi ed
property is inherited. Returns
true if not inherited; false if
inherited.
isPrototypeOf(obj)
JavaScript 1.5
Determines if the specifi ed
object is the prototype of
another object.
propertyIsEnumerable(propertyName)
JavaScript 1.5
Determines if the specifi ed
property can be seen by a
for
in
loop.
toString()
JavaScript 1.0
Converts the
Object
object into
a string.
valueOf()
JavaScript 1.1
Returns the primitive value of
the
Object
object.
RegExp
The
RegExp
object is used to fi nd patterns within string values.
RegExp
objects can be created in two
ways: using the
RegExp
constructor or a text literal. It was introduced in JavaScript 1.2.
Some of the properties in the following table have both long and short names. The short names are
derived from the Perl programming language.