The Object constructor creates an object wrapper.
// Object initialiser or literal
{ [ nameValuePair1[, nameValuePair2[, ...nameValuePairN] ] ] }
// Called as a constructor
new Object([value]) nameValuePair1, nameValuePair2, ... nameValuePairNvalueThe 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 a Type that corresponds to the given value. If the value is an object already, it will return the value.
When called in a non-constructor context, Object behaves identically to new Object().
See also the object initializer / literal syntax.
Object constructorObject.lengthObject.prototypeObject constructorObject.assign()Object.create()Object.defineProperty()Object.defineProperties()Object.entries()
[key, value] pairs.Object.freeze()Object.getOwnPropertyDescriptor()Object.getOwnPropertyDescriptors()Object.getOwnPropertyNames()Object.getOwnPropertySymbols()Object.getPrototypeOf()Object.is()Object.isExtensible()Object.isFrozen()Object.isSealed()Object.keys()Object.preventExtensions()Object.seal()Object.setPrototypeOf()[[Prototype]] property)Object.values()
Object instances and Object prototype objectAll objects in JavaScript are descended from Object; all objects inherit methods and properties from Object.prototype, although they may be overridden. For example, other constructors' prototypes override the constructor property and provide their own toString() methods. Changes to the Object prototype object are propagated to all objects unless the properties and methods subject to those changes are overridden further along the prototype chain.
Object.prototype.constructorObject.prototype.__proto__
Object.prototype.__noSuchMethod__
Object.prototype.__count__ Object.prototype.__parent__ Object.prototype.__defineGetter__()
Object.prototype.__defineSetter__()
Object.prototype.__lookupGetter__()
__defineGetter__() method.Object.prototype.__lookupSetter__()
__defineSetter__() method.Object.prototype.hasOwnProperty()Object.prototype.isPrototypeOf()Object.prototype.propertyIsEnumerable()Object.prototype.toSource()
Object.prototype.toLocaleString()toString().Object.prototype.toString()Object.prototype.unwatch()
Object.prototype.valueOf()Object.prototype.watch()
Object.prototype.eval() Object given undefined and null typesThe following examples store an empty Object object in o:
var o = new Object();
var o = new Object(undefined);
var o = new Object(null);
Object to create Boolean objectsThe following examples store Boolean objects in o:
// equivalent to o = new Boolean(true); var o = new Object(true);
// equivalent to o = new Boolean(false); var o = new Object(Boolean());
| Specification | Status | Comment |
|---|---|---|
| ECMAScript 1st Edition (ECMA-262) | Standard | Initial definition. Implemented in JavaScript 1.0. |
| ECMAScript 5.1 (ECMA-262) The definition of 'Object' in that specification. | Standard | |
| ECMAScript 2015 (6th Edition, ECMA-262) The definition of 'Object' in that specification. | Standard | Added Object.assign, Object.getOwnPropertySymbols, Object.setPrototypeOf, Object.is |
| ECMAScript 2017 Draft (ECMA-262) The definition of 'Object' in that specification. | Draft | Added Object.entries, Object.values and Object.getOwnPropertyDescriptors. |
| Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
|---|---|---|---|---|---|
| Basic support | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) |
| Feature | Android | Chrome for Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
|---|---|---|---|---|---|---|
| Basic support | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) |
© 2005–2017 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object