One, property
Object with a prototype property, that is, Object.prototype,object.prototype itself is also an object, there will be some properties and methods. As follows:
1, properties
Object.prototype.writable: Default to False
Object.prototype.enumerable: Default to False
Object.prototype.configurable: Default to False
Object.prototype.constructor: The prototype used to create an object.
2. Common methods
Object.prototype.hasOwnProperty (): Returns a Boolean value that indicates whether an object contains a specified property, and this property is not a prototype chain inheritance.
Object.prototype.isPrototypeOf (): Returns a Boolean value that indicates whether the specified object is in the prototype chain of this object.
Object.prototype.propertyIsEnumerable (): Determines whether the specified property is enumerable.
Object.prototype.toString (): Returns a string representation of an object.
Object.prototype.watch (): Adds a listener to an object's properties.
Object.prototype.unwatch (): Removes the listener for an object's properties.
Object.prototype.valueOf (): Returns the original value of the specified object.
Second, the method
Object.assign (target, ... sources): Copies the enumerable properties of any number of source objects to the target object, and then returns the target object.
Object.create (Proto,[propertiesobject]): Creates an object that has the specified prototype and several specified properties.
Object.defineproperties (obj, props): Adds or modifies one or more of its own properties on an object and returns the object.
Object.defineproperty (obj, prop, descriptor): Define a new attribute directly on an object, or modify an existing property and return the object. OBJ: An object that needs to define a property. Prop: The name of the attribute that needs to be defined or modified. Descriptor: The descriptor of the property that will be defined or modified.
Object.entries (obj): Returns an array of property name, property value key-value pairs that consist of property names and property values of all enumerable properties of the given object, and the order in which key value pairs are sorted in the array and the order returned when the object is traversed using the for...in loop.
Example:
var obj = {foo: ' Bar ', baz:42};
Console.log (object.entries (obj)); [[' foo ', ' Bar '], [' Baz ', 42]]
Object.freeze (obj): Freezing an object, freezing means that you cannot add new attributes to this object, you cannot modify the values of its existing properties, you cannot delete existing attributes, and you cannot modify the enumerable, configurable, and writable properties of an existing object. In other words, this object is always immutable. This method returns the Frozen object.
Object.getownpropertydescriptor (obj, prop): Returns a property descriptor corresponding to a property on the specified object.
Object.getownpropertynames (obj): Returns an array of property names, including non-enumerated properties, of all the properties of the specified object.
Example:
Class Array Object
var obj = {0: "A", 1: "B", 2: "C"};
Console.log (Object.getownpropertynames (obj). sort ()); ["0", "1", "2"]
Object.getprototypeof (object): Returns the prototype of the object.
Object.is (value1, value2): Determines whether two values are the same value.
Object.isextensible (obj): Determines whether an object is extensible (whether a new attribute can be added to it).
Object.isfrozen (obj): Determines whether an object is frozen (frozen).
Object.issealed (obj): Determines whether an object is sealed (sealed). Sealed objects are those that are not extensible and all their own properties are not configurable (non-configurable) and attributes cannot be deleted (they can be writable).
Object.keys (obj): Returns an array of property names for all enumerable properties of a given object, in which the order of the property names in the array is consistent with the order returned when the object is iterated by a for-in loop
Example:
var arr = ["A", "B", "C"];
Alert (Object.keys (arr)); Pop-up "0,1,2"
Class Array Object
var obj = {0: "A", 1: "B", 2: "C"};
Alert (Object.keys (obj)); Pop-up "0,1,2"
Object.preventextensions (obj): Make an object not extensible, that is, you can never add new attributes.
Object.setprototypeof (obj, prototype): Sets the prototype of a specified object to another object or null
Object.values (obj): Returns an array containing the values of the enumerable properties of the specified object, in the same order that the values in the array are used to iterate through the for...in.
Example:
var obj = {foo: ' Bar ', baz:42};
Console.log (object.values (obj)); [' Bar ', 42]
Turn from: http://blog.csdn.net/wlwanglu/article/details/52253002