valueOf()
Syntax:
number .valueOf()
Returns the primitive number value stor ed in number . This method is most often
invoked internally by JavaScript when needed and you will rarely need to call it ex-
plicitly.
E.15 Object (Core JavaScript)
The Object class object provides a superclass for a ll other objects in JavaScript. A ll
JavaScript objects inherit properties and methods from the prototype property of the
Object class.
Object Instance Creation
Object() //Constructor
Syntax:
new Object()
new Object(value )
The Object() constructo r c reates an a ppropr ia te wrapper object for value , which
can be of any type. If the constructor is invoked without an argument, then an empty
Object instance is created. It is possible to call the Object( ) con structor without the
new operator, but the eect is just the same.
Example:
new Object(true) //Equivalent to new Boolean(true)
new Object(10) //Equivalent to new Number(10)
{} //Literal syntax
Syntax:
{name1: value1 , name2 : value2 , ..., nameN : valueN }
Creates an Object instance with zero or more properties name1 , name2 , ..., nameN
having values value1 , value2 , ..., valueN , re spectively. Values can be of any type
while names can eith er be valid JavaScript ide ntifiers or strings.
420 JavaScript Reference
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.116.10.153