Java Reference
In-Depth Information
Table 4-11. ( continued )
Property/Method
Description
Object.prototype.
hasOwnProperty(prop)
Returns true if the object has the specified
property as its own property; returns false
otherwise
Object.prototype.isPrototypeOf(obj)
Returned true if the specified object is
the prototype of the object on which the
isPrototypeOf() method is called
Object.prototype.
propertyIsEnumerable(prop)
Returns true if the specified property is
enumerable; returns false otherwise
Object.prototype.toLocaleString()
Returned a localized string representation
of the object. It is intended to be
overridden by objects. By default, it returns
a string returned by the toString()
method
Object.prototype.toString()
Returns a string representation of the
object. It is intended to be overridden
by objects. By default, it returns a string
[object class] where class is the class
name of the object such as String , Date ,
Object , and so on
Object.prototype.valueOf()
If the object wraps a primitive value, it
returns that primitive value. Otherwise, it
returns the object itself
Object.seal(obj)
Seals the specified object
Object.setPrototypeOf(obj, proto)
Sets the specified proto as the prototype of
the specified obj
The Function Object
The Function object is a function that can be called as a function or a constructor. Calling
it as a function works the same way as calling it as a constructor. It creates a new function
object from a string. It takes variable number of arguments and it has the following
signature:
Function(p1, p2, p3,..., body);
Here, p1 , p2 , p3 , and so on are the names of the formal parameters of the new
function and body is the body of the function. The last argument is always the body of
the function. If it is called without any arguments, it creates an empty function with no
formal parameters and an empty body. The following snippet of code creates a function
 
 
Search WWH ::




Custom Search