Mozilla.com

Summary

Creates an object wrapper.

Syntax

new Object( [ value ] )

Parameters

value
Any value.

Description

The Object constructor creates an object wrapper for the given value. If the value is null or undefined, it will create and return an empty object, otherwise, it will return an object of type that corresponds to the given value.

When called in a non-constructor context, Object behaves identically.

Properties

For properties inherited by Object instances, see Properties of Object instances.

prototype
Allows the addition of properties to all objects of type Object.

Properties inherited from Function.prototype
caller, constructor, length, name

Methods

For methods inherited by Object instances, see Methods of Object instances.

Although the Object object contains no methods of its own, it does inherit some methods through the prototype chain.

Methods inherited from Function.prototype
apply, call, toSource, toString, valueOf

Object instances

prototype

Examples

Example: Using Object given undefined and null types

The following examples return an empty Object object:

var o = new Object();
o = new Object(undefined);
o = new Object(null);

Example: Using Object to create Boolean objects

The following examples return Boolean objects:

o = new Object(true);      // equivalent to o = new Boolean(true);
o = new Object(Boolean()); // equivalent to o = new Boolean(false);

Page last modified 04:09, 15 Jul 2008 by Cuimingda

Tags:

文件 (0)