Object Object (JavaScript)

Provides functionality common to all JavaScript objects.

Syntax


obj  
 = new Object([value])   

Parameters

obj
Required. The variable name to which the Object object is assigned.

value
Optional. Any one of the JavaScript primitive data types (Number, Boolean, or String). If value is an object, the object is returned unmodified. If value is null, undefined, or not supplied, an object with no content is created.

Remarks

The Object object is contained in all other JavaScript objects; all of its methods and properties are available in all other objects. The methods can be redefined in user-defined objects, and are called by JavaScript at appropriate times. The toString method is an example of a frequently redefined Object method.

In this language reference, the description of each Object method includes both default and object-specific implementation information for the intrinsic JavaScript objects.

Requirements

The Object Object was introduced in Internet Explorer before Internet Explorer 6. Some members in the following lists were introduced in later versions.

Properties

The following table lists properties of the Object Object.

Property Description
_proto\_ Property Specifies the prototype for an object.
constructor Property Specifies the function that creates an object.
prototype Property Returns a reference to the prototype for a class of objects.

Functions

The following table lists functions of the Object Object.

Function Description
Object.assign Function Copies the values from one or more source objects to a target object.
Object.create Function Creates an object that has a specified prototype, and that optionally contains specified properties.
Object.defineProperties Function Adds one or more properties to an object, and/or modifies attributes of existing properties.
Object.defineProperty Function Adds a property to an object, or modifies attributes of an existing property.
Object.freeze Function Prevents the modification of existing property attributes and values, and prevents the addition of new properties.
Object.getOwnPropertyDescriptor Function Returns the definition of a data property or an accessor property.
Object.getOwnPropertyNames Function Returns the names of the properties and methods of an object.
Object.getOwnPropertySymbols Function Returns the symbol properties of an object.
Object.getPrototypeOf Function Returns the prototype of an object.
Object.is Function Returns a value that indicates whether two values are the same value.
Object.isExtensible Function Returns a value that indicates whether new properties can be added to an object.
Object.isFrozen Function Returns true if existing property attributes and values cannot be modified in an object and new properties cannot be added to the object.
Object.isSealed Function Returns true if existing property attributes cannot be modified in an object and new properties cannot be added to the object.
Object.keys Function Returns the names of the enumerable properties and methods of an object.
Object.preventExtensions Function Prevents the addition of new properties to an object.
Object.seal Function Prevents the modification of attributes of existing properties, and prevents the addition of new properties.
Object.setPrototypeOf Function Sets the prototype of an object.

Methods

The following table lists methods of the Object Object.

Method Description
hasOwnProperty method Returns a Boolean value that indicates whether an object has a property with the specified name.
isPrototypeOf method Returns a Boolean value that indicates whether an object exists in another object's prototype hierarchy.
propertyIsEnumerable method Returns a Boolean value that indicates whether a specified property is part of an object and whether it is enumerable.
toLocaleString method Returns an object converted to a string based on the current locale.
toString method Returns a string representation of an object.
valueOf method Returns the primitive value of the specified object.

See Also

JavaScript Objects